lib/volt/models/persistors/model_store.rb in volt-0.7.12 vs lib/volt/models/persistors/model_store.rb in volt-0.7.13
- old
+ new
@@ -51,17 +51,19 @@
return id.join
end
# Called when the model changes
def changed(attribute_name=nil)
+ path = @model.path
+
promise = Promise.new
ensure_setup
- path_size = @model.path.size
+ path_size = path.size
if !(defined?($loading_models) && $loading_models) && @tasks && path_size > 0 && !@model.nil?
if path_size > 3 && (parent = @model.parent) && source = parent.parent
- @model.attributes[:"#{@model.path[-4].singularize}_id"] = source._id
+ @model.attributes[:"#{path[-4].singularize}_id"] = source._id
end
@tasks.call('StoreTasks', 'save', collection, self_attributes) do |errors|
if errors.size == 0
promise.resolve