Skip to content

Add support for Single Table Inheritance  #32

@mattiassvedhem

Description

@mattiassvedhem

I have set up a User model and a Manager model with Single Table inheritance like this :

class User < ActiveRecord::Base
  include Tenacity

  t_has_many :posts, :foreign_key => "user_id"
end
class Manager < User
end

And a Mongoid model :

class Post
  include Mongoid::Document
  include Tenacity

  field :name

  t_belongs_to :user
end

However the association only works when the user is a User and not a Manager.
If i try to add posts to a manager I just get an empty array when trying to fetch them trough user.posts.

Any thoughts on this?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions