所以我开始使用ember-rails并且我遇到了一个最令人烦恼的问题。
Ruby 2.1.0,Rails 4.0,Ember 1.10.0,Ember-Data 1.0.0-beta14.1,Ember-rails 0.16.1
我已经查阅过文档,谷歌和wonderful example app,但我没有太多运气。我确定我做错了什么,但我无法弄清楚那可能是什么。
错误:
Started GET "/" for 127.0.0.1 at 2015-02-12 20:30:14 -0500
ActiveRecord::SchemaMigration Load (0.2ms) SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by StuffController#index as HTML
Rendered stuff/index.html.erb within layouts/application (0.9ms)
Completed 500 Internal Server Error in 329ms
ActionView::Template::Error (Pre compilation failed for: {{render "navbar"}}
<div class="container-fluid">
{{outlet}}
</div>
Compiler said: ReferenceError: Can't find variable: window
(in /Users/cboebel/Documents/Development/Ruby/VQ/app/assets/javascripts/templates/application.handlebars)):
3: <head>
4: <title>VQ</title>
5: <%= stylesheet_link_tag 'application', media: "all" %>
6: <%= javascript_include_tag 'application' %>
7: <%= csrf_meta_tags %>
8: <%= favicon_link_tag '/assets/VQ-logo-transparent-RGB-72dpi.png' %>
9: </head>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___840981524341116597_2188195620'
Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (14.8ms)
Rendered /Users/cboebel/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (24.7ms)
Application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>VQ</title>
<%= stylesheet_link_tag 'application', media: "all" %>
<%= javascript_include_tag 'application' %>
<%= csrf_meta_tags %>
<%= favicon_link_tag '/assets/VQ-logo-transparent-RGB-72dpi.png' %>
</head>
<body style="padding-top: 60px;">
<%= yield %>
</body>
</html>
index.html.erb为空
的application.js
//= require jquery
//= require jquery-ui
//= require best_in_place
//= require jquery_ujs
//= require bootstrap
//= require handlebars
//= require ember
//= require ember-data
//= require_self
//= require app
App = Ember.Application.create({
LOG_ACTIVE_GENERATION: true,
LOG_VIEW_LOOKUPS: true,
LOG_TRANSITIONS: true,
LOG_TRANSITIONS_INTERNAL: true,
LOG_BINDINGS: true,
LOG_RESOLVER: true,
DEBUG: true
});
app.js
//= require store
//= require_tree ./adapters
//= require_tree ./mixins
//= require_tree ./models
//= require_tree ./controllers
//= require_tree ./views
//= require_tree ./helpers
//= require_tree ./components
//= require_tree ./templates
//= require_tree ./routes
//= require router
//= require_self
application.handlebars
{{render "navbar"}}
<div class="container-fluid">
{{outlet}}
</div>
修改
我应该指出我有
config.ember.variant = :development
in development.rb
修改
我&#34;修复&#34;这是通过为ember * gems和ember-rails的所有依赖项进行gem卸载然后重新安装它们。仍然不确定发生了什么。
答案 0 :(得分:2)
其他人的简短版本:升级到ember-rails 0.16.2(或更高版本)并将把手从v3降级为v2。
重新安装升级你过去this checkin ember-rails 0.16.1正在添加把手v3,导致'无法找到变量:窗口'问题。 ember-rails 0.16.2解决了这个问题。