@@ -2272,11 +2272,11 @@ function create(resourceName, attrs, options) {
22722272 return func . call ( attrs , resourceName , attrs ) ;
22732273 } )
22742274 . then ( function ( attrs ) {
2275- return DS . adapters [ options . adapter || definition . defaultAdapter ] . create ( definition , definition . serialize ( resourceName , attrs ) , options ) ;
2275+ return DS . adapters [ options . adapter || definition . defaultAdapter ] . create ( definition , options . serialize ? options . serialize ( resourceName , attrs ) : definition . serialize ( resourceName , attrs ) , options ) ;
22762276 } )
22772277 . then ( function ( res ) {
22782278 var func = options . afterCreate ? DS . $q . promisify ( options . afterCreate ) : definition . afterCreate ;
2279- var attrs = definition . deserialize ( resourceName , res ) ;
2279+ var attrs = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
22802280 return func . call ( attrs , resourceName , attrs ) ;
22812281 } )
22822282 . then ( function ( data ) {
@@ -2566,7 +2566,7 @@ function find(resourceName, id, options) {
25662566 if ( ! ( id in resource . pendingQueries ) ) {
25672567 promise = resource . pendingQueries [ id ] = DS . adapters [ options . adapter || definition . defaultAdapter ] . find ( definition , id , options )
25682568 . then ( function ( res ) {
2569- var data = definition . deserialize ( resourceName , res ) ;
2569+ var data = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
25702570 if ( options . cacheResponse ) {
25712571 // Query is no longer pending
25722572 delete resource . pendingQueries [ id ] ;
@@ -2651,7 +2651,7 @@ function _findAll(resourceName, params, options) {
26512651 resource . pendingQueries [ queryHash ] = DS . adapters [ options . adapter || definition . defaultAdapter ] . findAll ( definition , params , options )
26522652 . then ( function ( res ) {
26532653 delete resource . pendingQueries [ queryHash ] ;
2654- var data = definition . deserialize ( resourceName , res ) ;
2654+ var data = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
26552655 if ( options . cacheResponse ) {
26562656 try {
26572657 return processResults . call ( DS , data , resourceName , queryHash , options ) ;
@@ -3222,11 +3222,11 @@ function save(resourceName, id, options) {
32223222 attrs = changes ;
32233223 }
32243224 }
3225- return DS . adapters [ options . adapter || definition . defaultAdapter ] . update ( definition , id , definition . serialize ( resourceName , attrs ) , options ) ;
3225+ return DS . adapters [ options . adapter || definition . defaultAdapter ] . update ( definition , id , options . serialize ? options . serialize ( resourceName , attrs ) : definition . serialize ( resourceName , attrs ) , options ) ;
32263226 } )
32273227 . then ( function ( res ) {
32283228 var func = options . afterUpdate ? DS . $q . promisify ( options . afterUpdate ) : definition . afterUpdate ;
3229- var attrs = definition . deserialize ( resourceName , res ) ;
3229+ var attrs = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
32303230 return func . call ( attrs , resourceName , attrs ) ;
32313231 } )
32323232 . then ( function ( data ) {
@@ -3349,11 +3349,11 @@ function update(resourceName, id, attrs, options) {
33493349 return func . call ( attrs , resourceName , attrs ) ;
33503350 } )
33513351 . then ( function ( attrs ) {
3352- return DS . adapters [ options . adapter || definition . defaultAdapter ] . update ( definition , id , definition . serialize ( resourceName , attrs ) , options ) ;
3352+ return DS . adapters [ options . adapter || definition . defaultAdapter ] . update ( definition , id , options . serialize ? options . serialize ( resourceName , attrs ) : definition . serialize ( resourceName , attrs ) , options ) ;
33533353 } )
33543354 . then ( function ( res ) {
33553355 var func = options . afterUpdate ? DS . $q . promisify ( options . afterUpdate ) : definition . afterUpdate ;
3356- var attrs = definition . deserialize ( resourceName , res ) ;
3356+ var attrs = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
33573357 return func . call ( attrs , resourceName , attrs ) ;
33583358 } )
33593359 . then ( function ( data ) {
@@ -3489,11 +3489,11 @@ function updateAll(resourceName, attrs, params, options) {
34893489 return func . call ( attrs , resourceName , attrs ) ;
34903490 } )
34913491 . then ( function ( attrs ) {
3492- return DS . adapters [ options . adapter || definition . defaultAdapter ] . updateAll ( definition , definition . serialize ( resourceName , attrs ) , params , options ) ;
3492+ return DS . adapters [ options . adapter || definition . defaultAdapter ] . updateAll ( definition , options . serialize ? options . serialize ( resourceName , attrs ) : definition . serialize ( resourceName , attrs ) , params , options ) ;
34933493 } )
34943494 . then ( function ( res ) {
34953495 var func = options . afterUpdate ? DS . $q . promisify ( options . afterUpdate ) : definition . afterUpdate ;
3496- var attrs = definition . deserialize ( resourceName , res ) ;
3496+ var attrs = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
34973497 return func . call ( attrs , resourceName , attrs ) ;
34983498 } )
34993499 . then ( function ( data ) {
0 commit comments