Consider:
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'
Edit: I got confused for a while there. This is not really STI, it's just inheritance, as Employee
has its own table.
Thanks!