-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
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
Improper direct call to Model's parse without an instance #238
Comments
The rationale behind the line is described in commit 90ab97c:
That makes sense to me, so the attributes should definitely be parsed before calling |
I already am, but this doesn't stop
So the only reason parse is called like this is to |
The commit's author mentions:
So the attributes are something like this: {
person: {
id: 123,
name: "Douwe"
}
} And the parse: function(attributes) {
return attributes.person;
} The problem is not with |
Ok - I don't really have a solution (aside from changing this functionality based on a new option), and it's easy enough to workaround in |
I definitely see that the context not being the instance could be problematic, but since I don't see a better solution right now, I'm closing. Thanks for raising the issue though! |
For reference, there was discussion on Backbone itself about a similar issue. See jashkenas/backbone#2095 and jashkenas/backbone#2096 |
This line, from
findOrCreate
seems inappropriate.It caused a confusing bug for me because my
Model#parse
method expects itsthis
context to be an instance of the Model, which it is 99% of the time. But when called this way,this
is actually the model constructor, rather than an instance.With the new
{ parse: true }
option as of Backbone 0.9.9 whereparse
can be automatically called in a model's constructor, do we need this hack?The text was updated successfully, but these errors were encountered: