We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I met a particular case, I have a model that contains hasOne relationships which in themselves have same relationships.
The problem was that the toJSON took over the includeInJSON for the model but not for the related models
I propose to put this code in the toJSON function :
if(related.get( key ) instanceof Backbone.Model && _.isFunction(related.get( key ).toJSON)){
value[ key ] = related.get( key ).toJSON(options);
var nValue = {};
var subInJSON = related.getRelation(key).options.includeInJSON;
for(var nkey in subInJSON){
nValue[subInJSON[nkey]] = value[key][subInJSON[nkey]];
}
value[key] = nValue;
}else{
value[ key ] = related.get( key );
Sorry for my English
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello,
I met a particular case, I have a model that contains hasOne relationships which in themselves have same relationships.
The problem was that the toJSON took over the includeInJSON for the model but not for the related models
I propose to put this code in the toJSON function :
if(related.get( key ) instanceof Backbone.Model && _.isFunction(related.get( key ).toJSON)){
value[ key ] = related.get( key ).toJSON(options);
var nValue = {};
var subInJSON = related.getRelation(key).options.includeInJSON;
for(var nkey in subInJSON){
nValue[subInJSON[nkey]] = value[key][subInJSON[nkey]];
}
value[key] = nValue;
}else{
value[ key ] = related.get( key );
}
Sorry for my English
The text was updated successfully, but these errors were encountered: