为什么我的Ember-Rails“Hello World”应用程序不起作用?

时间:2012-06-22 17:59:59

标签: ruby-on-rails ember.js

我一直在尝试为rails项目评估emberjs。

有人建议(或者理想情况下是我的失败项目)如何让我的数据显示在视图中?我只运行rails g ember:bootstrap并创建了一个User表,其中包含一个属性username

链接到回购:https://github.com/Rhodee/ember-hello-world

控制台仅提供以下线索:

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

我已经将这些资源用于研究:

我在哪里可以找到最新的教程,反映如何连接到简单显示索引模板的状态?

2 个答案:

答案 0 :(得分:4)

您看到的前两个错误是open issue

我试图像你一样想出这一切。我通过更改样板来解决错误

MyApp.ApplicationController = Ember.ObjectController.extend

MyApp.ApplicationController = Ember.Object.extend

我希望有所帮助!

答案 1 :(得分:2)

我遇到了同样的问题,经过一番挖掘后发现了以下内容:

控制台错误是指当前稳定版本的Ember版本中缺少Ember.ObjectControllerEmber.ObjectController过去曾在旧版本的ember中被删除,现在正按照this stackoverflow answer中的说明重新进入。答案中还有(临时)解决方案。

最新的 ember版本(可通过ember github repo获得)包含此更改,我一直在尝试将其与ember-rails一起使用,同时阅读Ember Application Structure Guide。经过一番挖掘后,我发现Ember.State已更新为Ember.RouteconnectOutlets回调也有一些更新,详见this commit

引用一个ember-rails贡献者the ember-rails generators are a "mess"。因此,您可能必须使用上述修复程序更新一些生成的代码。

或者,我建议使用他们使用的确切设置(在他们的示例应用程序代码中提供)浏览脑病教程。

相关问题