Class: ModelIdentityMap
- Inherits:
-
GenericCountingPool
- Object
- GenericPool
- GenericCountingPool
- ModelIdentityMap
- Defined in:
- lib/volt/models/persistors/model_identity_map.rb
Overview
The identity map ensures that there is only one copy of a model used on the front end at a time.
Instance Attribute Summary
Attributes inherited from GenericPool
Instance Method Summary collapse
-
#add(id, model) ⇒ Object
add extends GenericCountingPool so it can add in a model without a direct lookup.
Methods inherited from GenericCountingPool
#find, #generate_new, #lookup, #remove, #transform_item
Methods inherited from GenericPool
#create_new_item, #initialize, #lookup, #lookup_all, #remove, #transform_item
Constructor Details
This class inherits a constructor from GenericPool
Instance Method Details
#add(id, model) ⇒ Object
add extends GenericCountingPool so it can add in a model without a direct lookup. We use this when we create a model (without an id) then save it and it gets assigned an id.
9 10 11 |
# File 'lib/volt/models/persistors/model_identity_map.rb', line 9 def add(id, model) @pool[id] = [1, model] end |