lib/volt/models/persistors/model_store.rb in volt-0.8.27.beta1 vs lib/volt/models/persistors/model_store.rb in volt-0.8.27.beta2
- old
+ new
@@ -34,11 +34,12 @@
@in_collection = false
end
# Called the first time a value is assigned into this model
def ensure_setup
- if @model.attributes
- @model.attributes[:_id] ||= generate_id
+ if (attrs = @model.attributes)
+ # Do a nil check incase there is a nil model there
+ @model.__id = generate_id if attrs[:_id].nil?
add_to_identity_map
end
end