aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-27 22:07:41 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-27 22:07:41 -0200
commit0ef2256c4a7635e78126cce4aa2c7467d2fb414f (patch)
tree6c6471e9dac32d303a93c5cde655123f4eef6faf /activerecord/lib
parentc19d664380199dac1474c303cf4f8b416986f106 (diff)
parent33a5416461bc5068d85d33259310f56625569e86 (diff)
downloadrails-0ef2256c4a7635e78126cce4aa2c7467d2fb414f.tar.gz
rails-0ef2256c4a7635e78126cce4aa2c7467d2fb414f.tar.bz2
rails-0ef2256c4a7635e78126cce4aa2c7467d2fb414f.zip
Merge pull request #18383 from scambra/habtm-with-where-includes-16032-for-master
Includes HABTM returns correct size now
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index ca473beea3..0e98a3b3a4 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -150,7 +150,8 @@ module ActiveRecord
message_bus.instrument('instantiation.active_record', payload) do
result_set.each { |row_hash|
- parent = parents[row_hash[primary_key]] ||= join_root.instantiate(row_hash, column_aliases)
+ parent_key = primary_key ? row_hash[primary_key] : row_hash
+ parent = parents[parent_key] ||= join_root.instantiate(row_hash, column_aliases)
construct(parent, join_root, row_hash, result_set, seen, model_cache, aliases)
}
end