Permalink
Browse files

Merge pull request #15676 from sgrif/sg-object-hash

Defer to super, rather than re-implementing Object#hash
  • Loading branch information...
2 parents 1cec61f + 930c330 commit 86bbfbc113d7682f4e994bebbf7a60b74ce653ae @matthewd matthewd committed Jun 13, 2014
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/core.rb
@@ -380,7 +380,11 @@ def ==(comparison_object)
# 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

0 comments on commit 86bbfbc

Please sign in to comment.