Fixed a bug with revertAttributes getting set during SuperModel duplicate model merging.

This commit is contained in:
Nick Winter 2014-09-02 18:28:02 -07:00
parent 6eb23349d0
commit 681cc4656f
2 changed files with 4 additions and 4 deletions

View file

@ -61,11 +61,11 @@ class CocoModel extends Backbone.Model
else
super(attribute)
set: ->
set: (attributes, options) ->
delete @attributesWithDefaults
inFlux = @loading or not @loaded
@markToRevert() unless inFlux or @_revertAttributes
res = super(arguments...)
@markToRevert() unless inFlux or @_revertAttributes or @project or options?.silent
res = super attributes, options
@saveBackup() if @saveBackups and (not inFlux) and @hasLocalChanges()
res

View file

@ -120,7 +120,7 @@ module.exports = class SuperModel extends Backbone.Model
cachedModel = @getModelByURL(model.getURL())
if cachedModel
clone = $.extend true, {}, model.attributes
cachedModel.set(clone, {silent: true})
cachedModel.set(clone, {silent: true, fromMerge: true})
console.debug "Updated cached model <#{cachedModel.get('name') or cachedModel.getURL()}> with new data"
else
@registerModel(model)