Isak Hansen wrote: > On 5/23/07, Tirta K. Untario <tkunta...@gmail.com> wrote: >> t.column "email", :string >> >> def username=(user) >> @username = user.downcase >> end >> >> But it results in username being NULL in the table. >> >> Any advice would be very helpful. Thanks. >> > > AR model attributes aren't simply instance variables. The api docs for > ActiveRecord::Base explain how you go about overriding the default > accessors. > > > Isak
For bypassing the infinite loop, you could use this too: def before_save self.username.downcase! end D. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---