hzamani / acts_as_relation

Multi table Inheritance for rails
http://hzamani.github.com/acts_as_relation/
MIT License
180 stars 58 forks source link

has_many through is not working #25

Closed bigardone closed 4 years ago

bigardone commented 11 years ago

Hi! I don't know if this is a bur or not, but I have the following models:

class Client < ActiveRecord::Base
    acts_as_superclass
    belongs_to :company
    ...
end

class Provider < ActiveRecord::Base
    acts_as :client
    ...
end

class Company < ActiveRecord::Base
    has_many :clients
    has_many :providers, through: :clients
    ...
end

If I try to get the providers of a Company, I get the following error:

ctiveRecord::HasManyThroughSourceAssociationNotFoundError: Could not find the source association(s) :provider or :providers in model Client. Try 'has_many :providers, :through => :clients, :source => <name>'. Is it one of :as_client, :contact_people, :addresses, or :company?

Is it a bug or am I creating the relation in a wrong way? Thanks in advance!

hzamani commented 11 years ago

Isn't it same as what you had in issue 9?