I have a requirement to have a small system where I have a number of "clubs", and members of this club. A user can be a member of more than one club.
I have the models defined:
club: has_many :club_members has_many :users , through: club_members
user: has_many :club_members has_many :clubs , through: club_members
club_member belongs_to :club belongs_to :user
I have managed to come up with a crude hack (selection list, and storing the member ids as a comma-separated list in the club, but that is so wrong it's making my eyes bleed just looking at the code ;)
What I am trying to achieve is to go to a form, add / remove members, and then when the form is posted , manipulate the models above to permanently save the data accordingly.
So, I actually have 2 questions:
1) Are the models above right ? 2) teaching a man to fish, are there any examples or projects that I can browse / examine that show the relationship management of adding / removing members of a club, both UI and backend ?
many thanks