[Rails] Console: non riesco ad utilizzare i modelli

Ho creato la seguente tabella nel database dell’ environment
“development”:

create table students(
id int auto_increment,
name varchar(50) not null,
surname varchar(50) not null,
registered_at timestamp not null,
class varchar(2),
primary key(id)
);

Dopodichè ho generato il modello con il solito
$ ruby script/generate model student

Poi accedo alla console ma ottengo degli errori se cerco di utilizzare
la classe di modello generata

$ ruby script/console

roby = Student.new
=> #<Student id: nil, name: nil, surname: nil, registered_at: nil,
class: nil>

roby.name = “roby”
NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.generated_methods

Ottengo errore anche facendo

r = Student.new :name=>“roby”
NoMethodError: You have a nil object when you didn’t expect it!

Sinceramente non lo capisco. Altre volte l’ho fatto senza problemi.
Forse qualcosa mi sfugge.

Ciao e grazie

2009/3/30 Roberto C. [email protected]:

);
Non chiamare un campo class. Confondi ActiveRecord.

Ciao,
Antonio

http://antoniocangiano.com - Zen and the Art of Programming
http://math-blog.com - Mathematics is wonderful!
http://stacktrace.it - Aperiodico di resistenza informatica
Follow me on Twitter: http://twitter.com/acangiano
Author of “Ruby on Rails for Microsoft Developers” (Wrox, 2009)

Antonio C. wrote:

2009/3/30 Roberto C. [email protected]:

);
Non chiamare un campo class. Confondi ActiveRecord.

Ciao,
Antonio

http://antoniocangiano.com - Zen and the Art of Programming
http://math-blog.com - Mathematics is wonderful!
http://stacktrace.it - Aperiodico di resistenza informatica
Follow me on Twitter: http://twitter.com/acangiano
Author of “Ruby on Rails for Microsoft Developers” (Wrox, 2009)

Grazie!

Non ci avevo pensato.