Module: Hoodie::IdentityMap::ClassMethods

Defined in:
lib/hoodie/identity_map.rb

Instance Method Summary collapse

Instance Method Details

#get(id, options = nil) ⇒ Object



61
62
63
# File 'lib/hoodie/identity_map.rb', line 61

def get(id, options = nil)
  get_from_identity_map(id) || super
end

#load(id, attrs) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/hoodie/identity_map.rb', line 70

def load(id, attrs)
  if IdentityMap.enabled? && instance = IdentityMap.repository[id]
    instance
  else
    super.tap { |doc| doc.add_to_identity_map }
  end
end