Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
 * make sure options are passed into Model.parse()
 * make sure {silent: x} options are passed along to .save()
  • Loading branch information
uglymunky committed May 20, 2014
1 parent 546febe commit 2e138c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/backbone.siren.action.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ Action.prototype = {
, actionName: actionName
, success: function (model, resp, options) {
parent.trigger('sync:' + actionName, model, resp, options);
Backbone.Siren.parse(resp, {store: store});

// @todo - I think too much logic is going into this. Much of this stuff is probably already
// done in backbone. Eventually will need a refactor of .execute() and better integration with backbone.
Backbone.Siren.parse(resp, {store: store, silent: options.silent});
}
, error: function (model, xhr, options) {
parent.trigger('error:' + actionName, model, xhr, options);
Expand Down
11 changes: 9 additions & 2 deletions src/backbone.siren.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,16 @@ _.extend(BbSiren, {
}


, update: function (rawModel) {
/**
* Updates the model with the properties from a "rawModel"
*
* @param {Object} rawModel
* @param {Object} [options]
* @returns {Backbone.Siren.Model}
*/
, update: function (rawModel, options) {
if (BbSiren.isLoaded(rawModel)) {
this.set(this.parse(rawModel));
this.set(this.parse(rawModel), options);
this.parseActions();
}

Expand Down

0 comments on commit 2e138c8

Please sign in to comment.