instance method
hash
Ruby on Rails 7.1.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 609
def hash
id = self.id
if primary_key_values_present?
self.class.hash ^ id.hash
else
super
end
end
Defined in activerecord/lib/active_record/core.rb line 609
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Core