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
http://localhost:3000
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?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.