Re: [Rails] Re: Overwriting modifiers methods with Rails

2010-04-09 Thread Andy Jeffries
Ahh OK, useful to know. It would be helpful (in languages/frameworks in general) if a deprecation always had a comment on where to look for more information. Generally Rails is good at this, but maybe that information isn't filtered through to APIDock.com. Cheers, Andy -- Andy Jeffries http:

[Rails] Re: Overwriting modifiers methods with Rails

2010-04-08 Thread Joe Smith
:Frederick Cheung: Couldn't see any trace in the source of write attribute being marked as deprecated. It (ActiveRecord::Base#write_attribute) is not just deperecated, it is gone. But another method with the same name in a different class (ActiveRecord::AttributeMethods#write_attribute) repl

[Rails] Re: Overwriting modifiers methods with Rails

2010-04-08 Thread Frederick Cheung
On Apr 8, 2:32 pm, Andy Jeffries wrote: > > I'm sure I've seen it in later versions, but thought I'd post it anyway. > > If it is deprecated, another way is: > > self.attributes['name'] = name + 'blah blah' > > It's not exactly the same as write_attribute (it doesn't typecast to numbers > for nu

Re: [Rails] Re: Overwriting modifiers methods with Rails

2010-04-08 Thread Andy Jeffries
> > > 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_attribu

Re: [Rails] Re: Overwriting modifiers methods with Rails

2010-04-08 Thread Jeremy Chase
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 wrote: > > > On Apr 8, 9:54 am, Marco Antonio Filho wrote: > > > class Unit < ActiveRecord::Base > > > > def name= name > >

[Rails] Re: Overwriting modifiers methods with Rails

2010-04-08 Thread Frederick Cheung
On Apr 8, 9:54 am, Marco Antonio Filho 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.