Friday, November 6, 2009

[Rails] Re: How can I make an aggregated property support ActiveRecord::Dirty semantics?

On Nov 6, 12:51 pm, Eric Hahn <e...@ingroup.com> wrote:
> So basically, I'm not getting ActiveRecord::Dirty semantics on aggregated attributes (they are on the underlying db attrs).
>
> Is there a beautiful way to implement dirty semantics on the aggregation? I'm not having a lot of luck with alias_attribute_with_dirty, etc.  I really am unfond of making my own range_changed?, range_was, etc.  Frankly, I was a bit surprised that aggregation didn't support dirty natively...

The dirty stuff is all centred around actual attributes. you could
define

def range_changed?
range_begin_changed? || range_end_changed
end

def range_was
range_begin .. range_end
end

and so on. shouldn't be too hard to automate definition of these
methods.

Fred
>
> Advice greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate