Re:Decorating ActiveRecord Accessor Methods
by texel on Friday June 26, 2009 @12:40AM
(#674961)
Yes, I suppose that would have worked as well, and would've been more in the spirit of the first attempt at a solution, but it wouldn't have been very general, and it certainly wouldn't have worked for all models in the application (without a lot of manual intervention).
[ Parent
| on HN ]
Re:Decorating ActiveRecord Accessor Methods
by mattmcknight on Friday June 26, 2009 @11:26PM
(#676557)
Oh, it could be made general, just add the name of the actual datetime field as a parameter of the hash. Then you could drop the method into ActiveRecord. Anyway, the second solution is okay, because it is explicit enough. However it it still builds a dependency on define_attribute_methods.