join same rails models twice, eg people has_many clubs through membership AND people has_many clubs through committee

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-06-04T08:36:40Z Indexed on 2010/12/22 21:54 UTC
Read the original article Hit count: 180

Models: * Person * Club

Relationships * Membership * Committee

People should be able to join a club (Membership) People should be able to be on the board of a club (Committee)

For my application these involve vastly different features, so I would prefer not to use a flag to set (is_board_member) or similar.

I find myself wanting to write:

People has_many :clubs :through => :membership # :as => :member? :foreign_key => :member_id? has_many :clubs :through => :committee # as (above)

but I'm not really sure how to stitch this together

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about activerecord