Either this is not supported or I’m just not seeing the forest for the
trees. Here’s the model relationship I currently have that works:
class Officer < AR::Base
has_many :clients, :through => :officer_relationships
end
class Clients < AR::Base
has_many :officers, :through => :officer_relationships
has_many :accounts
end
class OfficerRelationships < AR::Base
belongs_to :client
belongs_to :officer
end
My problem is that I’m trying to associate the Account’s model through
the OfficerRelationship model and the Client model by doing the
following:
class Officer < AR::Base
has_many :clients, :through => :officer_relationships
has_many :accounts, :through => :clients
end
or the following:
class Officer < AR::Base
has_many :clients, :through => :officer_relationships
has_many :accounts, :through => :clients
end
class OfficerRelationships < AR::Base
belongs_to :client
belongs_to :officer
has_many :accounts, :through => :client
end
None of these work. Am I just trying to get more out of HasManyThrough
than it was designed to? If so, can someone point me in the right
direction as to the best DRY way to do this without replicating the
OfficerRelationship model for every one of the client’s accounts?