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?
When using has_many :through => :something, does the type of relationships matter? E.g., If
Share
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_manyandbelongs_toat the same time. It just worked as expected in my case.