Module: NCore::Identity

Extended by:
ActiveSupport::Concern
Defined in:
lib/ncore/identity.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#==(comparison_object) ⇒ Object Also known as: eql?

from ActiveRecord::Core



32
33
34
35
36
37
# File 'lib/ncore/identity.rb', line 32

def ==(comparison_object)
  super ||
    comparison_object.instance_of?(self.class) &&
    !id.nil? &&
    comparison_object.id == id
end

#hashObject



40
41
42
43
44
45
46
# File 'lib/ncore/identity.rb', line 40

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

#json_rootObject



48
49
50
# File 'lib/ncore/identity.rb', line 48

def json_root
  self.class.json_root
end