diff options
author | Diego Algorta <diego@oboxodo.com> | 2010-05-15 12:33:18 -0300 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-05-15 16:53:59 +0100 |
commit | 3436fdfc12d58925e3d981e0afa61084ea34736c (patch) | |
tree | 72638ace2cd5c272a066c80c1ddaee094821dfba /activerecord/lib/active_record/associations.rb | |
parent | 2d84f24af5cb0854a316929fa0d0720773be2162 (diff) | |
download | rails-3436fdfc12d58925e3d981e0afa61084ea34736c.tar.gz rails-3436fdfc12d58925e3d981e0afa61084ea34736c.tar.bz2 rails-3436fdfc12d58925e3d981e0afa61084ea34736c.zip |
Fix for get_ids when including a belongs_to association on a has_many association [#2896 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 0a3c7c6a60..634d4a181a 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1398,7 +1398,7 @@ module ActiveRecord primary_key = reflection.source_reflection.primary_key_name send(through.name).select("DISTINCT #{through.quoted_table_name}.#{primary_key}").map!(&:"#{primary_key}") else - send(reflection.name).select("#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").map!(&:id) + send(reflection.name).select("#{reflection.quoted_table_name}.#{reflection.klass.primary_key}").except(:includes).map!(&:id) end end end |