I have models like that:
class Person
has_many :groups
has_many :group_memberships, :foreign_key => "member_id"
end
class Group_Membership
belongs_to :member, :class_name => 'Person'
belongs_to :group
end
class Group
belongs_to :person
has_many :group_memberships
has_many :members, :class_name => "Person", :through => "group_memberships", :foreign_key => "member_id"
end
I was just wandering, if a Person wants to join a group, the person will create a group_membership that will need both the id of the Person itself and the Group. If I do a single create button without a form on the group view would be right? And how would be the def create
since I will have to pass both ids via build
right? Thanks.