I have a User model, a Membership model, and a Club model. I have set up the following associations:
Club.rb
has_many :memberships
has_many :members, through: :memberships
Membership.rb
belongs_to :user
belongs_to :club
What I want now is to have a has_one :organizer on Club that retrieves a single User record based on the member with the organizer attribute set to true in the join model.
How do I set up this has_one association? I've tried going through the memberships association, but an exception is raised that the memberships is a collection and needs to be singular.