Callback Problem: Why to use self.var= instead of @var=

Hi,

I've defined the following model:

class Eintrag < ActiveRecord::Base   before_validation :vali

  protected   def vali   # self.feld1.reverse!     self.feld2 = self.feld1   end end

Now I'm wondering why I have to write self.feld2=self.feld1 and why @feld2=@feld1 doesn't work.

I've found the thread http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/3405e38a2f34e896/7cfa3cb86d87d034?lnk=gst&q=callback+self+instance#7cfa3cb86d87d034 But it's missing the reason.

Thanks, martin

Because activerecord attributes aren't stored as instance variables.

Fred