Closed marcusmacinnes closed 11 years ago
@braddunbar -- any thoughts on this one?
:+1: I think parsing by default is a good thing.
me too, seems like I am always having to do { parse : true }
I'm a bit confused now about the current behavior. Wouldn't this be better:
parse
function is defined.Yep, that sounds great to me.
I like it!
@jashkenas I raised a concern in the commit https://github.com/documentcloud/backbone/commit/fbbb2e675e594f023ca17cf3708bfb07601e8ff2#commitcomment-2221749
@jashkenas The problem still exists.. Can I re-open this issue?
Scenario: When the server responds to a fetch with a deep data document (containing data for nested models and collections).
The fetching "root" model should parse it's part of the "data", but that model shouldn't know anything about the child model's parsing requirements. The root model should be be able to pass the parse flag down the chain so that child models which are not yet instantiated can perform "their" parse of "their" part of the data.
It's important therefore be able to push this parse flag down the chain and this can only be done by setting a default options.parse = true with:
if (options.parse === void 0) options.parse = true;
as indicated in the code original post above...
Any thoughts?
@marcusmacinnes It's in master now :+1:
Perfect - thanks
The Collection's fetch method correctly sets a default value for options.parse=true which allows for the collection's models to be parsed.
The Model's fetch method doesn't set the default value for options.parse=true which prohibits the default parsing of nested models and collections.
Can we bring the behavior of these two methods into sync by adding the following line:
to the model's fetch method as follows:
This will enable consistent parsing behavior and facilitate the ability to parse nested models and collections.