I'm new to Ruby on Rails and I can't understand why the following simple command is not working.
2.2.1 :031 > Category.new(:name => 'Example')
=> #<Category id: nil, name: nil, created_at: nil, updated_at: nil>
I define :name
as 'Example'
but the object created has name
set to nil
. What I am trying to do is to create a new object and then persist it to the database from Category
model .
It is probably simple but does not make sense to a beginner !
Thanks
Aucun commentaire:
Enregistrer un commentaire