Skip to content
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

[BUGFIX beta] Do not allow manually specifying application resource. #10533

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/ember-routing/lib/system/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ DSL.prototype = {
}

var type = options.resetNamespace === true ? 'resource' : 'route';
Ember.assert("'" + name + "' cannot be used as a " + type + " name.", name !== 'array' && name !== 'basic' && name !== 'object');
Ember.assert(
"'" + name + "' cannot be used as a " + type + " name.",
(function() {
if (options.overrideNameAssertion === true) { return true; }

return ['array', 'basic', 'object', 'application'].indexOf(name) === -1;
})()
);

if (Ember.FEATURES.isEnabled("ember-routing-named-substates")) {
if (this.enableLoadingSubstates) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var EmberRouter = EmberObject.extend(Evented, {
});

function generateDSL() {
this.resource('application', { path: "/" }, function() {
this.resource('application', { path: "/", overrideNameAssertion: true }, function() {
for (var i=0; i < dslCallbacks.length; i++) {
dslCallbacks[i].call(this);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-routing/tests/system/dsl_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ QUnit.module("Ember Router DSL", {
});

QUnit.test("should fail when using a reserved route name", function() {
var reservedNames = ['array', 'basic', 'object'];
var reservedNames = ['array', 'basic', 'object', 'application'];

expect(reservedNames.length * 2);

Expand Down