diff options
author | Matthew Draper <matthew@trebex.net> | 2014-06-13 09:59:32 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-06-13 09:59:32 +0930 |
commit | 86bbfbc113d7682f4e994bebbf7a60b74ce653ae (patch) | |
tree | fc3e0c5de108fbe367330fd21867f43c6a23682b | |
parent | 1cec61fc13a9809b616f1dcc74c1a9ccea9db08c (diff) | |
parent | 930c330cec1dbc47c4a8083a63dfbfba3c7031b1 (diff) | |
download | rails-86bbfbc113d7682f4e994bebbf7a60b74ce653ae.tar.gz rails-86bbfbc113d7682f4e994bebbf7a60b74ce653ae.tar.bz2 rails-86bbfbc113d7682f4e994bebbf7a60b74ce653ae.zip |
Merge pull request #15676 from sgrif/sg-object-hash
Defer to super, rather than re-implementing Object#hash
-rw-r--r-- | activerecord/lib/active_record/core.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 6d1897ab40..86b4cc90ea 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -380,7 +380,11 @@ 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 || object_id).hash + if id + id.hash + else + super + end end # Clone and freeze the attributes hash such that associations are still |