jwood / tenacity

A database client independent way of managing relationships between models backed by different databases.
MIT License
118 stars 17 forks source link

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

Open mateusamerico opened 11 years ago

mateusamerico commented 11 years ago

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"

msanfilippof commented 7 years ago

Did you solve it?