Topic: has_many :through multiple?
I want to have a has_many :through relationship work through another has_many :through relationship on the same model. I can currently achieve this basic effect by using some hackery, but I'd rather avoid it.
has_many :model_cs, :through => :model_bs
has_many :model_as, :through => :model_bs
I want to be able to call ModelA.find(:first).model_ds. I can achieve this approximately by doing this:
# in ModelA
def model_ds; model_cs.collect(&:model_d).uniq; end
But I'd prefer something cleaner and more Rails-like. Anyone know a better way?