rhodee
rhodee

Reputation: 1267

Why isn't my Ember-Rails "Hello World" app working?

I've been trying to evaluate emberjs for a rails project.

Can someone suggest (or ideally for my failing project) how get my data to display in the view? I've only run rails g ember:bootstrap and created a User table with a single attribute username.

Link to repo: https://github.com/Rhodee/ember-hello-world

The console provides only these clues:

Uncaught TypeError: Cannot call method 'extend' of undefined application_controller.js:1
Uncaught TypeError: Cannot call method 'extend' of undefined user_controller.js:1
Uncaught TypeError: Object <Ember.Object:ember282> has no method 'removeArrayObserver' ember.js:11068

I've already utilized these resources for study:

Where can I find up-to-date tutorials reflecting the state of how to get things wired up to simply display an index template?

Upvotes: 2

Views: 1781

Answers (2)

Dom Christie
Dom Christie

Reputation: 4240

I had the same problem, and after a bit of digging discovered the following:

The console errors refer to the absence of Ember.ObjectController in the current stable ember release. Ember.ObjectController used to be in older versions of ember, was taken out, and is now making its way back in as stated in this stackoverflow answer. There is also a (temporary) solution in that answer.

The latest ember release (available via the ember github repo) includes this change, and I've been attempting to use it with ember-rails, whilst reading the Ember Application Structure Guide. After some more digging, I found that Ember.State has since been updated to Ember.Route, and there are also some updates to the connectOutlets callback, as detailed in this commit.

To quote an ember-rails contributor, the ember-rails generators are a "mess". So you may have to update some of the generated code with the fixes mentioned above.

Alternatively, I'd recommend going through the cerebris tutorial using the exact setup as they have used (available in their example app code).

Upvotes: 2

Jason L Perry
Jason L Perry

Reputation: 1255

The first two errors you're seeing are an open issue.

I'm trying to figure this all out, like you. I resolved the errors by changing the boilerplate from

MyApp.ApplicationController = Ember.ObjectController.extend

to

MyApp.ApplicationController = Ember.Object.extend

I hope that helps!

Upvotes: 4

Related Questions