opensourcecatholic / marriage-booklet

To help Catholic couples plan their wedding mass
4 stars 2 forks source link

re-associate "role" with project (role in project) rather than with the user resource itself #93

Open JohnRDOrazio opened 3 years ago

JohnRDOrazio commented 3 years ago

Considering that a user could theoretically participate in more than one project with a different role

CASE: 1) a bride creates her wedding booklet on this website 2) she is satisfied with the experience, and invites a friend of hers to make their booklet on the website 3) the friend would like her to help out, and adds her as a guest to the wedding booklet project 4) the initial bride would have role "bride" on her own booklet project, but role "guest" on her friend's booklet project

This means that the user "role" should probably not be associated with the user resource itself (as is currently the case), but should be an association between a user and a project. I'm guessing a kind of a join table? We have (at least in theory) a join table between users and projects. Perhaps a "user role" field could be added to this same join table?

JohnRDOrazio commented 3 years ago

Perhaps this would require using a :has_many => through association rather than a has_and_belongs_to_many association? See here.

JohnRDOrazio commented 3 years ago

here is a little bit of info on an example of a join table with extra attributes: https://blog.codedge.io/rails-join-table-with-extra-attributes/