diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-12-22 10:13:21 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-23 15:19:18 -0800 |
commit | 1619c2435b2b9c821b2b0dcab9624dbb6b23eaaa (patch) | |
tree | a07493a80002b29b2e0202a451b9c3ab2d7dd22b /activerecord/lib | |
parent | 4e13625818579551c01640cb405a8c22a3bd0e68 (diff) | |
download | rails-1619c2435b2b9c821b2b0dcab9624dbb6b23eaaa.tar.gz rails-1619c2435b2b9c821b2b0dcab9624dbb6b23eaaa.tar.bz2 rails-1619c2435b2b9c821b2b0dcab9624dbb6b23eaaa.zip |
Revert "Optimize <association>_ids for hm:t with belongs_to source". The optimisation has too many edge cases, such as when the reflection, source reflection, or through reflection has conditions, orders, etc. [#6153 state:resolved]
This reverts commit 373b053dc8b99dac1abc3879a17a2bf8c30302b5.
Conflicts:
activerecord/lib/active_record/associations.rb
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index c0cd222244..e4dff69efe 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1512,16 +1512,9 @@ module ActiveRecord if send(reflection.name).loaded? || reflection.options[:finder_sql] send(reflection.name).map { |r| r.id } else - if reflection.through_reflection && reflection.source_reflection.belongs_to? - through = reflection.through_reflection - primary_key = reflection.source_reflection.primary_key_name - send(through.name).select("DISTINCT #{through.quoted_table_name}.#{primary_key}").map! { |r| r.send(primary_key) } - else - send(reflection.name).select("#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").except(:includes).map! { |r| r.id } - end + send(reflection.name).select("#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").except(:includes).map! { |r| r.id } end end - end def collection_accessor_methods(reflection, association_proxy_class, writer = true) |