def year
published_at.year
end
def year=(y)
published_at.year = y
end
# Same for month and day
The 'delegate' method allows you to delegate a member access to a
member with the same name on a different member object, so you can
avoid writing 'content.published_at.year'
I was wondering where this 'delegate' method is defined, so I looked
it up and found it in ActiveSupport--it's a method defined in the
Module class. Pretty tricky :)
Available here, if anyone else is interested:
activesupport/lib/active_support/core_ext/module/delegation.rb
Duane Johnson
(canadaduane)
http://blog.inquirylabs.com/