Skip to content

Commit

Permalink
In the Record model, override toJSON() and omit the lazy-loaded Omeka…
Browse files Browse the repository at this point in the history
… item body.
  • Loading branch information
davidmcclure committed Apr 10, 2015
1 parent 8407d6e commit 16f91e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion views/shared/javascripts/src/shared/record/record.model.js
Expand Up @@ -28,7 +28,6 @@ Neatline.module('Shared.Record', function(Record) {
return this.attributes.item;

},
transient: true
}

},
Expand Down Expand Up @@ -57,6 +56,16 @@ Neatline.module('Shared.Record', function(Record) {
},


/**
* Remove the lazy-loaded `item` content before saving.
*
* @return {Object}: The record values.
*/
toJSON: function() {
return _.omit(_.clone(this.attributes), 'item');
},


/**
* Construct the REST API endpoint for the record. If the record hasn't
* been saved, use the generic `/records` endpoint, which handles the
Expand Down

0 comments on commit 16f91e7

Please sign in to comment.