aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-12 17:43:41 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-12 17:43:41 -0600
commit1cec61fc13a9809b616f1dcc74c1a9ccea9db08c (patch)
tree8c5fc63671cceef7962e43abaff97288036175c4 /activerecord/lib/active_record/core.rb
parent6857415187810f1289068a448268264d0cf0844f (diff)
parentd82dafe65c1137a2f84975c202d471054533f7bc (diff)
downloadrails-1cec61fc13a9809b616f1dcc74c1a9ccea9db08c.tar.gz
rails-1cec61fc13a9809b616f1dcc74c1a9ccea9db08c.tar.bz2
rails-1cec61fc13a9809b616f1dcc74c1a9ccea9db08c.zip
Merge pull request #15665 from sgrif/sg-id-perf
Fix performance regression on preloading HABTM associations
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 7edaf256c7..6d1897ab40 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -380,7 +380,7 @@ module ActiveRecord
# Delegates to id in order to allow two records of the same type and id to work with something like:
# [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
def hash
- id.hash
+ (id || object_id).hash
end
# Clone and freeze the attributes hash such that associations are still