nl_tokens: Convert relations to JSON omits them when required
pl_tokens: function ( options ) { // If this Model has already been fully serialized in this branch once, return to avoid loops if ( this . isLocked ( ) ) { return this . id ; } this . acquire ( ) ; var json = Backbone . Model . prototype . toJSON . call ( this , <mask> ) ; if ( this . constructor . _superModel && ! ( this . constructor . _subModelTypeAttribute in json ) ) { json [ this . constructor . _subModelTypeAttribute ] = this . constructor . _subModelTypeValue ; } _ . each ( this . _relations , function ( rel ) { var related = json [ rel . key ] , includeInJSON = rel . options . includeInJSON , value = null ; if ( includeInJSON === true ) { if ( related && _ . isFunction ( related . toJSON ) ) { value = related . toJSON ( options ) ; } } else if ( _ . isString ( includeInJSON ) ) { if ( related instanceof Backbone . Collection ) { value = related . pluck ( includeInJSON ) ; } else if ( related instanceof Backbone . Model ) { value = related . get ( includeInJSON ) ; } // Add ids for 'unfound' models if includeInJSON is equal to (only) the relatedModel's `idAttribute` if ( includeInJSON === rel . relatedModel . prototype . idAttribute ) { if ( rel instanceof Backbone . HasMany ) { value = value . concat ( rel . keyIds ) ; } else if ( rel instanceof Backbone . HasOne ) { value = value || rel . keyId ; } } } else if ( _ . isArray ( includeInJSON ) ) { if ( related instanceof Backbone . Collection ) { value = [ ] ; related . each ( function ( model ) { var curJson = { } ; _ . each ( includeInJSON , function ( key ) { curJson [ key ] = model . get ( key ) ; } ) ; value . push ( curJson ) ; } ) ; } else if ( related instanceof Backbone . Model ) { value = { } ; _ . each ( includeInJSON , function ( key ) { value [ key ] = related . get ( key ) ; } ) ; } } else { delete json [ rel . key ] ; } if ( includeInJSON ) { json [ rel . keyDestination ] = value ; } if ( rel . keyDestination !== rel . key ) { delete json [ rel . key ] ; } } ) ; this . release ( ) ; return json ; }