How can I make an aggregated property support ActiveRecord::Dirty semantics?

Hoping one of the many experts here might help out a newb...

I have an aggregated attribute which I want to be able ask about its _changed? ness, etc.

composed_of :range,
:class_name => 'Range',
:mapping => [ %w(range_begin begin), %w(range_end end)],
:allow_nil => true

If I use the aggregation:

foo.range = 1..10

This is what I get:

foo.range # => 1..10
foo.range_changed? # NoMethodError
foo.range_was # ditto
foo.changed # ['range_begin', 'range_end']

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...

Advice greatly appreciated.

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