@@ -2272,11 +2272,11 @@ function create(resourceName, attrs, options) {
2272
2272
return func . call ( attrs , resourceName , attrs ) ;
2273
2273
} )
2274
2274
. 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 ) ;
2276
2276
} )
2277
2277
. then ( function ( res ) {
2278
2278
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 ) ;
2280
2280
return func . call ( attrs , resourceName , attrs ) ;
2281
2281
} )
2282
2282
. then ( function ( data ) {
@@ -2566,7 +2566,7 @@ function find(resourceName, id, options) {
2566
2566
if ( ! ( id in resource . pendingQueries ) ) {
2567
2567
promise = resource . pendingQueries [ id ] = DS . adapters [ options . adapter || definition . defaultAdapter ] . find ( definition , id , options )
2568
2568
. then ( function ( res ) {
2569
- var data = definition . deserialize ( resourceName , res ) ;
2569
+ var data = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
2570
2570
if ( options . cacheResponse ) {
2571
2571
// Query is no longer pending
2572
2572
delete resource . pendingQueries [ id ] ;
@@ -2651,7 +2651,7 @@ function _findAll(resourceName, params, options) {
2651
2651
resource . pendingQueries [ queryHash ] = DS . adapters [ options . adapter || definition . defaultAdapter ] . findAll ( definition , params , options )
2652
2652
. then ( function ( res ) {
2653
2653
delete resource . pendingQueries [ queryHash ] ;
2654
- var data = definition . deserialize ( resourceName , res ) ;
2654
+ var data = options . deserialize ? options . deserialize ( resourceName , res ) : definition . deserialize ( resourceName , res ) ;
2655
2655
if ( options . cacheResponse ) {
2656
2656
try {
2657
2657
return processResults . call ( DS , data , resourceName , queryHash , options ) ;
@@ -3222,11 +3222,11 @@ function save(resourceName, id, options) {
3222
3222
attrs = changes ;
3223
3223
}
3224
3224
}
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 ) ;
3226
3226
} )
3227
3227
. then ( function ( res ) {
3228
3228
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 ) ;
3230
3230
return func . call ( attrs , resourceName , attrs ) ;
3231
3231
} )
3232
3232
. then ( function ( data ) {
@@ -3349,11 +3349,11 @@ function update(resourceName, id, attrs, options) {
3349
3349
return func . call ( attrs , resourceName , attrs ) ;
3350
3350
} )
3351
3351
. 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 ) ;
3353
3353
} )
3354
3354
. then ( function ( res ) {
3355
3355
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 ) ;
3357
3357
return func . call ( attrs , resourceName , attrs ) ;
3358
3358
} )
3359
3359
. then ( function ( data ) {
@@ -3489,11 +3489,11 @@ function updateAll(resourceName, attrs, params, options) {
3489
3489
return func . call ( attrs , resourceName , attrs ) ;
3490
3490
} )
3491
3491
. 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 ) ;
3493
3493
} )
3494
3494
. then ( function ( res ) {
3495
3495
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 ) ;
3497
3497
return func . call ( attrs , resourceName , attrs ) ;
3498
3498
} )
3499
3499
. then ( function ( data ) {
0 commit comments