I am struggling with a simple Single table Inheritance example.
I have two models, generated as follows:
script/generate scaffold Contact type:string created_at:datetime
script/generate scaffold Person fname:string lname:string
I amended the Person model:
class Person < Contact
I then expected to be able to create a Person, with a fname, but this
fails (the following is from script/console):-
@person = Person.new => #<Person id: nil, type: "Person", created_at: nil, updated_at: nil>
@person.fname = "niciliketo"
NoMethodError: undefined method `fname=' for #<Person:0xb6e8e5fc>
The examples I can find are pretty terse, and don't seem to explain
why this isn't working. Can anyone tell me why this happens?