I thought it could be created in a few steps but it can't yet:
rails poly cd poly
ruby script/generate scaffold animal name:string obj_type:string obj_id:integer rake:migrate
ruby script/generate scaffold human name:string passportNumber:string rake:migrate
ruby script/generate scaffold dog name:string registrationNumber:string rake:migrate
and now change app/models/animal.rb to:
class Animal < ActiveRecord::Base belongs_to :obj, :polymorphic => true end
and run
ruby script/server
and go to
I thought on the server then if I create an Michael, Human, J123456 and then Woofie, Dog, L23456
then the database will have entries in the Dogs table and "Humen" or "Humans" table as well as in the Animals table? But only the Animals table has records, Dogs and "Humen" do not for some reason. Is there some steps missing?