So you would do def name= name write_attribute :name, name end
-- Jeremy Chase http://twitter.com/jeremychase On Thu, Apr 8, 2010 at 9:04 AM, Frederick Cheung <[email protected] > wrote: > > > On Apr 8, 9:54 am, Marco Antonio Filho <[email protected]> wrote: > > > class Unit < ActiveRecord::Base > > > > def name= name > > @name = name + 'bla bla' > > end > > > > end > > > > In Ruby I could do this, but this doesn't affect my object at all... > > The key thing is that ActiveRecord attributes aren't instance > variables. You can use write_attribute to write to the store of > attributes. > > Fred > > > > How can I do that? > > > > Thanks in advance > > -- > > Marco Antonio > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [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-talk?hl=en.

