Railsters: Given two models, Frog and Pond, suppose we have a habtm between them - frogs_ponds. This statement... frog.ponds << Pond.new ...does not trigger any frog.after_update calls. How can we connect frogs to ponds and update correctly when the link itself changes - not the frogs or ponds? -- Phlip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 21 Nov 2007, at 00:21, Phlip wrote:> > Railsters: > > Given two models, Frog and Pond, suppose we have a habtm between them > - frogs_ponds. > > This statement... > > frog.ponds << Pond.new > > ...does not trigger any frog.after_update calls. > > How can we connect frogs to ponds and update correctly when the link > itself changes - not the frogs or ponds?Association callbacks might float your boat: http://barrykeenan.blogspot.com/2007/08/association-callbacks.html Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Association callbacks might float your boat:http://barrykeenan.blogspot.com/2007/08/association-callbacks.htmlOutrageous - that was it! (and note we used :after_add, because :update_ is irrelevant to an association table.) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---