1.use console
#rails console
2.create new subject instance
subject = new Subject
subject.new_record?
subject = Subject.new(:name=>"first man",:position=>2,:visible=>true)
subject.save
3.create sceond subject instance
subject = Subject.create(:name=>"second man",:position=>1,:visible=>true)
subject.save
4.use mysql command to confirm this
#mysql -u root -p
use cms_development
select * from Subjects;
沒有留言:
張貼留言