lundi 16 mai 2016

rails db structure and relationship - how to

I have a working app that needs to be copied to web app using ROR. There is a scenario i dont know how to create DB and give relationship.

There is JobType model has_many presettings i have given. eg:

there is brakes jobtype which will have 50 presettings, like that each jobtype will have more than or nearly 50 presettings.

No problem till now.

Now a car comes for service, that is called Job which might have many problem -> JobType (eg brake problem). Those 50 presettings need to be loaded for each job also now but should be editable. worker can add a comment to particular presetting that this is been done.

I have done job has_many presettings through job_entry. Since the UI works based on json response i can't add/update only particular presetting. I have to duplicate all 50 records to JobEntry(through table) table so it will be easy to update and give response. Is there any better way to do the db structure?

Aucun commentaire:

Enregistrer un commentaire