Module: MongoMapper::Plugins::IdentityMap::InstanceMethods

Defined in:
lib/mongo_mapper/plugins/identity_map.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



121
122
123
124
# File 'lib/mongo_mapper/plugins/identity_map.rb', line 121

def delete
  identity_map.delete(_id) if self.class.identity_map_on?
  super
end

#identity_mapObject



110
111
112
# File 'lib/mongo_mapper/plugins/identity_map.rb', line 110

def identity_map
  self.class.identity_map
end

#save(*args) ⇒ Object



114
115
116
117
118
119
# File 'lib/mongo_mapper/plugins/identity_map.rb', line 114

def save(*args)
  if result = super
    identity_map[_id] = self if self.class.identity_map_on?
  end
  result
end