On Wed, Feb 9, 2011 at 6:33 PM, Jeremy Evans <[email protected]> wrote:
> I was planning on adding the feature as a plugin before 3.21.0. It's > fairly simple. Use an anonymous module for each class, and for every > many_to_one call, add the foreign key setter method to the anonymous > module to clear the association cache for the association if the value > has changed (calling super in either case). That way you can just do > "Sequel::Model.plugin :stale_associations" before defining your models > and automatically get the behavior. > > Anyone who wants to implement it first is welcome to submit a patch/ > pull request. :) > I'm working on it. Any given column can act as a foreign key for more than one association though. Given that, do you still think that the logic should be in the setter method? It would have to iterate over all associations that use that column. I think it might be easier to overload the association accessor. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
