Module: Mongo::Model::IdentityMap::ClassMethods
- Defined in:
- lib/mongo/model/identity_map.rb
Instance Method Summary collapse
Instance Method Details
#from_mongo(doc) ⇒ Object
24 25 26 27 28 |
# File 'lib/mongo/model/identity_map.rb', line 24 def from_mongo doc model = super doc model.class.identity_map[model.id] = doc if model.id model end |
#get_from_identity_map(id) ⇒ Object
19 20 21 22 |
# File 'lib/mongo/model/identity_map.rb', line 19 def get_from_identity_map id doc = identity_map[id] from_mongo doc if doc end |
#identity_map ⇒ Object
15 16 17 |
# File 'lib/mongo/model/identity_map.rb', line 15 def identity_map @identity_map ||= {} end |