instance method
hash
Ruby on Rails 6.0.6
Since v4.0.13Signature
hash()
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) ]
Source
# File activerecord/lib/active_record/core.rb, line 456
def hash
if id
self.class.hash ^ id.hash
else
super
end
end
Defined in activerecord/lib/active_record/core.rb line 456
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core