Hello,
In a situation where a user has_many :groups (it owns the group) but also has_and_belongs_to_many :groups, how is this most easily represented?
The only way i have found is
user.rb: has_many :groups
has_and_belongs_to_many :memberships, ,:join_table => ‘memberships’, :class => ‘group’
group.rb belongs_to :user has_and_belongs_to_many :memberships, , :join_table => ‘memerships’, :class => ‘user’
I think there is an opportunity to have a new model membership.rb that belongs_to :user, belongs_to :group where a user has_many :groups, :through => :membership but not 100% sure.
What is the cleanest approach here?
Adam