Skip to content

Commit

Permalink
Merge pull request jashkenas#2420 from gsamokovarov/model-no-url-option
Browse files Browse the repository at this point in the history
Don't attach url if passed as an option in Model
  • Loading branch information
braddunbar committed Mar 23, 2013
2 parents 42d3588 + e91b36c commit dd49c6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
};

// A list of options to be attached directly to the model, if provided.
var modelOptions = ['url', 'urlRoot', 'collection'];
var modelOptions = ['urlRoot', 'collection'];

// Attach all inheritable methods to the Model prototype.
_.extend(Model.prototype, Events, {
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,8 @@ <h2 id="Model">Backbone.Model</h2>
</p>

<p>
<tt>{url: "..."}</tt> and/or <tt>{urlRoot: "..."}</tt> options may be passed
when creating a new model that needs to have a custom one-off URL endpoint.
<tt>{urlRoot: "..."}</tt> option may be passed when creating a new model
that needs to have a custom one-off URL endpoint.
</p>

<p>
Expand Down
8 changes: 3 additions & 5 deletions test/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,9 @@ $(document).ready(function() {
equal(model.url(), '/nested/1/collection/2');
});

test('url and urlRoot are directly attached if passed in the options', 2, function () {
var model = new Backbone.Model({a: 1}, {url: '/test'});
var model2 = new Backbone.Model({a: 2}, {urlRoot: '/test2'});
equal(model.url, '/test');
equal(model2.urlRoot, '/test2');
test('urlRoot is directly attached if passed in the options', 1, function () {
var model = new Backbone.Model({a: 2}, {urlRoot: '/test'});
equal(model.urlRoot, '/test');
});

test("underscore methods", 5, function() {
Expand Down

0 comments on commit dd49c6a

Please sign in to comment.