Bringing up (trying!) my first rails app… no OO experience
the scaffold generator automatically creates new activerecord objects
for the create/edit form using:
def new
@schoolclass = Schoolclass.new
end
I wanted to initialize the object, so I added to the object creation
statement as follows:
@schoolclass = Schoolclass.new(:day=>1, :start_time=>"2006:01:01
00:00:00, :description=>“enter description here”)
I was expecting that I could access the attributes of @schoolclass with
(e.g.) @schoolclass.day .A breakpoint right after the object creation
allows me to see the initialized attributes using @schoolclass.inspect,
BUT when I look at individual attribues using (e.g.) @schoolclass.day or
@schoolclass[:day] or @schoolclass[“day”] , they are all NIL.
What am I not seeing here? This exactly follows the example in the
ActiveRecord::Base documentation! How can I access the initialized
object attributes?
thanks in advance for any light you can shed!
Les