tenacity icon indicating copy to clipboard operation
tenacity copied to clipboard

Relationship with polymorphic: true doesn't set base_class in field_type

Open mateusamerico opened this issue 11 years ago • 1 comments

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"

mateusamerico avatar May 08 '13 18:05 mateusamerico

Did you solve it?

msanfilippof avatar Apr 19 '17 10:04 msanfilippof