When using has_many :through => :something, does the type of relationships matter? E.g., If A has_many C :through => :b, does it make a difference whether model A belongs_to B which has_many C or model A has_many B which has_many C?
Asked
Active
Viewed 39 times
1 Answers
0
If you're using Rails 3.x, it shouldn't matter much which kind of relation you are using. ActiveRecord is smart enough to create the proper SQL for you. The details on what is actually supported keep changing from release to release, so you should make a good number of tests to make sure it works as expected.
I've made some really complicated relations with Rails 3, going through a couple of has_many
and belongs_to
at the same time. It just worked as expected in my case.

iain
- 16,204
- 4
- 37
- 41