Method: ActiveRecord::Core#hash

Defined in:
lib/active_record/core.rb

#hashObject

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) ]


451
452
453
454
455
456
457
# File 'lib/active_record/core.rb', line 451

def hash
  if id
    self.class.hash ^ id.hash
  else
    super
  end
end