I am new with ruby on rails and I am following Ruby on Rails 3 Essential Training 2010 from Lynda.
I have a problem with creating records in rails console even though I create the subject it returns nil. This is the code from the console:
vane@vane-HP-G70-Notebook-PC:~/Sites/simple_cms$ rails c
Loading development environment (Rails 3.2.8)
1.9.3-p194 :001 > subject = Subject.new(:name => "Fourth Subject", :position => 4, :visible => true)
=> Subject id: nil, name: nil, position: nil, visible: false, created_at: nil, updated_at: nil>
1.9.3-p194 :002 > subject.save (0.1ms) BEGIN SQL (0.4ms) INSERT INTO
subjects
(created_at
,name
,position
,updated_at
,visible
) VALUES ('2012-10-10 15:06:11', NULL, NULL, '2012-10-10 15:06:11', 0) (56.4ms) COMMIT=> true
It doesn't show any error so I don't now what to do. Any help will be appreciated.
This is what i have in app>models subject.rb:
class Subject < ActiveRecord::Base
attr_accessor :name, :position, :visible
attr_accessible :name, :position, :visible
end