Re: [Rails] Re: Problem with attr_accessor

2010-09-14 Thread Dave Aronson
On Tue, Sep 14, 2010 at 09:44, Marnen Laibow-Koser wrote: > That's not true.  In an instance method, self refers to the object. Oops, you're right, on further research it seems to be a slippery little bugger. No wonder I usually see people using @ (or @@) instead -Dave -- Specialization

[Rails] Re: Problem with attr_accessor

2010-09-14 Thread Marnen Laibow-Koser
Pål Bergström wrote: > I pass a value from controller to model with attr_accessor. before_save > works fine but not after_find. What could be wrong? Note this sentence from the documentation: "Unlike all the other callbacks, after_find and after_initialize will only be run if an explicit impleme

[Rails] Re: Problem with attr_accessor

2010-09-14 Thread Marnen Laibow-Koser
Dave Aronson wrote: > P�l Bergstr�m wrote: > >> def crypt_data >> � � �self.name = Crypto.encrypt(self.name,key) >> end >> >> def decrypt_data >> � � �self.name = Crypto.decrypt(self.name,key) >> end > > Are you sure you don't mean @name? This is Ruby, not Python, so self > would generally refer