Displaying 1 result from an estimated 1 matches for "seter".
Did you mean:
  peter
  
2007 May 20
2
Newbie question - self.var OR @var in ActiveRecord
I started learning rails by following the agile way. It comes to the
point where it puzzles me.
class Puzzle < ActiveRecord::Base
  # virtual var, not existing in the database
  def var
    @var
  end
  def var=(foo)
    @var= foo
    @var_in_database = @var + 1 # var_in_database exists in database
  end
end
Then when I do a save of this model it does nothing. I know that if I
instead put