0
Tenir compte:Un objet polymorphes qui appartient à un objet quasi-IST: object_type est incorrect
class Person < ActiveRecord::Base
class << self
def setup
has_one :address, :as => :addressable
end
end
end
class Employee < Person
setup
end
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
# Shouldn't this be 'Employee'? Is it possible to override?
Employee.create.address.create.addressable_type == 'Person'
Modifier: Je suis confus pendant un certain temps là-bas. Ce n'est pas vraiment STI, c'est juste héritage, car Employee
a sa propre table.
Merci!