Closed mandytrex closed 9 years ago
Got this.
Does a Group have_many Users and it also has a special User called a coordinator. Is that what you're going for?
Yes, I want the user who started the group to be saved as the coordinator for group. So I want that user's ID to be saved as the group's coordinator_id.
Is this possible?
@htella
And yes to your first question, a group has many users as well
Yup, add an association on Groups that looks like
belongs_to :coordinator, :class_name => 'User', :foreign_key => 'coordinator_id'
Check this out for more of an example. Look the first answer.
http://stackoverflow.com/questions/2684843/belongs-to-with-class-name-option-fails
Thank you!
Hey, I have having a difficult time with one of my relationships.
Attached is a copy of my ERD and my most up to date code is pushed. The relationship I am confused with lies within my Groups Table, the attribute "coordinator_id" -- I would like for this to reference the user_id of the user who created the group. I've reviewed the Active Record associations/migrations documentation and I think my issue is not being certain of what exactly to search for within those documentations to resolve my issue. Let me know if I can explain this better in person
Thanks, Amanda
@htella @DrRobotmck