sbeam
sbeam

Reputation: 4892

Ember router construction - App.Router.create undefined (with ember-rails)

I am trying to get Ember working in an existing Rails app, so install the ember-rails gem. It gave me a app.js based on this generator template that contains

var router = App.router = App.Router.create({
  enableLogging: true,
  location: 'hash'
});

App.initialize(router);

I also wanted to use ember-data, and saw some posts saying edge is the only way to go with that. So so updated both ember-data and ember.js itself to edge.

So when I run this, I get Uncaught TypeError: Cannot call method 'create' of undefined on the App.Router.create line.

I'm guessing that the API has changed and this is obsolete, but can't find the current canonical way of creating this router object.

Upvotes: 0

Views: 1860

Answers (1)

dechov
dechov

Reputation: 1833

The examples here are canonical AFAIK: http://emberjs.com/guides/outlets/

...except that Ember.State should be Ember.Route now. But this is what you want to do:

App.Router = Ember.Router.extend({
  enableLogging: true,
  location: 'hash'
});

App.initialize();

Upvotes: 1

Related Questions