Displaying 1 result from an estimated 1 matches for "contactdata".
Did you mean:
constantdata
2005 Dec 19
8
Single Table Inheritance question
....
person.rb
class Person < ActiveRecord::Base
has_many :contacts
end
client.rb
class Client < Person
end
contact.rb
class Contact < ActiveRecord::Base
belongs_to :person
end
phone.rb
class Phone < Contact
end
In script/console Ive run:
c = Client.find :first
c.phones.create :contactdata => 555-555-5555
and get NoMethodError : undefined method phones etc
I tried moving the relationships in to the client and phone models but then
there was an SQL error: Unknown column contacts.client_id because the
contacts table has a person_id column not a client_id column. Any help...