From: Devin Mullins Date: 2005-09-12T08:32:49+09:00 Subject: Re: Misunderstanding of instance variables Matthew D Moss wrote: >Okay, so the above basically works. But I wondered why the author I >borrowed this from used "self." instead of @ -- I thought both would >essentially reference an instance variable. > >So I replaced the one line to look like this: > @content_type = arg.content_type.chomp >and it fails, triggering my validation checks. > > self.content_type = blahblahblah is an invocation of an instance method named "content_type=". In typical implementations of this method*, invocation causes an instance variable @content_type to be set. In the case of ActiveRecord, I guess that's not the case. Devin *see attr_writer