-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Make model parameter optional for Backbone.sync #4002
base: master
Are you sure you want to change the base?
Conversation
Sorry but -- what's the use case? Every extra conditional is one more potential bug. |
It's a bit hard to explain, but basically it comes down to this: I have a number of things that are automatically attached to all Backbone.sync requests (e.g. a unique ID for each request, centralised error handling et cetera), which is why I'd like to use Backbone.sync for a multipart/formdata RPC request, to benefit from the extras, but all the data it's sending is massaged and collected, i.e. there's no specific model that I need to use. As I said, I can easily solve it, but I assumed that |
To be honest, I'm not sure why that's there (but it's been there for years), along with the |
We should either add this, or remove the |
I was curious about this guard and for posterity it was introduced by 4c1bdb4. Seems safe to remove it. |
Back then the guard made totally sense, since |
I thought of that (removing it doesn't fail any tests), but what's the harm in keeping it? In this case it's probably fine to remove, but I think recent history has shown that we tend to get bit by edge cases we think are safe to get rid of. Let's just make sure we have tests covering the expected behaviors. |
I encountered a situation in which I needed to call Backbone.sync directly, w/o a model, which works perfectly except it will throw when trying to trigger a 'request' event on
model
. Obviously I could easily pass atrigger:noop
object or something, but thought this was cleaner.Test included btw.