I have four models: a, b, c, d
here is what I want to do:
a has_many b, :through => c
a has_many d, :through => b
so that in the console I can then do:
a.b
a.b.first.d
a.d
currently the first two commands work but on the third I get an SQL error. it appears to be trying to go straight through b to get d and not picking up the fact that a -> b goes through c.
How to solve?
I dont think you can call
a.ddirectly but you can doa.b.map(&:d).flattento get alldofa