On Mar 30, 2007, at 1:39 PM, Xavier Noria wrote:

> Another approach is to redefine the setter:
>
>   def date=(v)
>     v = my_date_parser(v) if v.is_a?(String)
>     write_attribute(:date, v)
>   end

Let me add here that as far as DRYness is concerned that approach was  
considered because the idea was to generate those setters via AR  
introspection on the columns and their types somewhere, like  
self.inherited on an abstract model of the application.

-- fxn


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to