Ruby on rails 应用中的Rails Nomethoder错误#索引

Ruby on rails 应用中的Rails Nomethoder错误#索引,ruby-on-rails,Ruby On Rails,我在一个Rails项目中遇到了一个针对nil:NilClass的“未定义的方法”[]”错误 错误来自myapp/views/layouts/application.html.erb <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 对不起,我刚刚发现了错误。我使用的是EmberJS,我在视图文件夹中放了一个hbs文件,它应该在模板中。在我移动hbs文件后,错误消失了。你能提

我在一个Rails项目中遇到了一个针对nil:NilClass的“未定义的方法”[]”错误

错误来自my
app/views/layouts/application.html.erb

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

对不起,我刚刚发现了错误。我使用的是EmberJS,我在
视图
文件夹中放了一个hbs文件,它应该在
模板
中。在我移动hbs文件后,错误消失了。

你能提供你被触发的url吗?嗨,这是确定的,我想你应该发布你路由的根url。我不认为你的应用程序控制器中没有运行或调用对象。你能发布你的日志吗?这可能是环境问题,而不是代码问题。我尝试更改为“默认值”,然后javascript文件没有包括在内
Started GET "/" for ::1 at 2015-11-05 17:08:04 +0800
  ActiveRecord::SchemaMigration Load (0.1ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by ApplicationController#index as HTML
  Rendered application/index.html.erb within layouts/application (0.8ms)
Completed 500 Internal Server Error in 842ms (ActiveRecord: 0.0ms)

ActionView::Template::Error (undefined method `[]' for nil:NilClass):
    3: <head>
    4:   <title>Guildmasters</title>
    5:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
    6:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    7:   <%= csrf_meta_tags %>
    8: </head>
    9: <body>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___1282808844249308017_70187111969200'


  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (11.3ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.0ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (56.2ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.5ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.3ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.4ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.4ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts/javascript (42.1ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/javascript (0.6ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.4ms)
  Rendered /usr/local/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (91.5ms)