vendredi 4 novembre 2016

Model setup for storing checklists in rails

I am having a hard time determining the best methods to store checklists in Rails.

In my application, there are accounts which have many documents. I would like to add a checklist to each document such that the checklist items can be configured by an account. All of the documents will have the same checklist (configured by account) but may have different checked/unchecked values for each item.

The setup would look something like this:

Account
  Document1
    ChecklistItem1 - isCheckedForDocument1
    ChecklistItem2 - isCheckedForDocument1
    ChecklistItem3 - isCheckedForDocument1

  Document2
    ChecklistItem1 - isCheckedForDocument2
    ChecklistItem2 - isCheckedForDocument2
    ChecklistItem3 - isCheckedForDocument2

Just wondering how I can setup the models/migrations to store these types of checklists.

I have looked at several other questions such as Database Design for Storing Checklists and Results and What would be a good approach for storing the results of a checklist in Rails? but each of them differ slightly from my situation and it's really throwing me off.




Aucun commentaire:

Enregistrer un commentaire