Displaying 1 result from an estimated 1 matches for "mcking".
Did you mean:
making
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
...completely
dumb, and my scope trickery doesn''t make it any better.
Now, let''s assume for a moment that participants was a plain has_many
association. Then it would be possible to write things like
m.participants.clear
m.participants << Person.find_by_name(''Steve McKing'')
m.participant_ids = params[:movie][:participants]
With the given has_many :through, none of these work, as Role object
won''t validate without a role type. Anyway, what I would like to write
is
m.participants.as(''actor'').clear
m.participants.as(''act...