diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-27 22:07:41 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-27 22:07:41 -0200 |
commit | 0ef2256c4a7635e78126cce4aa2c7467d2fb414f (patch) | |
tree | 6c6471e9dac32d303a93c5cde655123f4eef6faf /activerecord/lib/active_record/associations | |
parent | c19d664380199dac1474c303cf4f8b416986f106 (diff) | |
parent | 33a5416461bc5068d85d33259310f56625569e86 (diff) | |
download | rails-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/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 3 |
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 |