search for: attr_acessor

Displaying 2 results from an estimated 2 matches for "attr_acessor".

Did you mean: attr_accessor
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
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see anything like the syntax you see people using in rails code. Specifically when you see. belongs_to :Person has_many :Phones etc these are methods on ActiveRecord right? Why is this invocation syntax never described in the Pick Axe book? I do see things like attr_reader :some_attribute etc but you