I’m creating a chore tracker app as my first Rails project and I’m wondering if the associations I've created make sense or could be improved. Here are the details of the app:
- A user makes a chore list and becomes the “owner”(i.e. “admin”) of that list.
- The owner can create/edit chores for the list. They can also “approve" other users to complete tasks on the list. These users can ONLY complete tasks.
- The owner, along with the usual admin abilities, can also complete tasks on a list that they own.
- Owners can own multiple lists. Users can be approved to complete tasks on multiple lists.
And here are the relationships I’ve roughed out that I’m looking for feedback on:
(Model)User
- has_many :lists
- has_many :owners, class_name: “List”, foreign_key: “list_id"
- has_many :chores, through: :lists
(Model)List
- has_many :users
- has_many :chores
- belongs_to :owner, class_name: “User”, foreign_key: “owner_id"
(Model)User_List
- belongs_to :user
- belongs_to :list
(Model)Chore
- belongs_to :list
- has_many :users, through: :lists
Any red flags? Thank you in advance!