tenacity
tenacity copied to clipboard
Relationship with polymorphic: true doesn't set base_class in field_type
I have the following code:
class Parent < ActiveRecord::Base
include Tenacity
t_has_many :cars, as: :owner
end
class Child < Parent
attr_accessible :type
end
class Car
include Mongoid::Document
include Mongoid::Timestamps
include Tenacity
t_belongs_to :owner, polymorphic: true
attr_accessible :owner
end
Running the command on console: car = Car.new(owner: Child.new)
I have the result:
car.owner_type: "Child"
But the expected behavior from polymorphic using ActiveRecord is:
car.owner_type: "Parent"
Did you solve it?