Permalink
Browse files

removing unnecessary options check

  • Loading branch information...
1 parent e12e1d8 commit 03f1de06d11e959fc8c9c3598afd0bd357e3b2d8 @tgriesser tgriesser committed Dec 27, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 backbone.js
View
@@ -536,8 +536,7 @@
// returning `true` if all is well. Otherwise, fire a general
// `"error"` event and call the error callback, if specified.
_validate: function(attrs, options) {
- if (!options || !options.validate || !this.validate) return true;
- options || (options = {});
+ if (!options.validate || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validationError = this.validate(attrs, options) || null;
if (!error) return true;

2 comments on commit 03f1de0

Collaborator

braddunbar replied Dec 27, 2012

I think @caseywebdev added this one to ensure that Model#validate always gets options (even if they're empty). I agree that it's not strictly necessary, but it's definitely more friendly and consistent. I'll pull request with a test.

Collaborator

braddunbar replied Dec 27, 2012

Actually, it seems that this is always handled by the calling function. Should've checked first. Sorry to bother @tgriesser. :)

Please sign in to comment.