0

我有一个 Rails 应用程序,它在浏览器中抛出错误We're sorry, but something went wrong.。我继续检查日志,这就是我得到的:

Compiled visitor.js  (0ms)  (pid 15667)
Compiled application.js  (3574ms)  (pid 15667)
Compiled visitor.css  (73ms)  (pid 15667)
Compiled aboutvideos.css  (1ms)  (pid 15667)
Compiled admin.css  (1ms)  (pid 15667)
Compiled bootstrap_and_overrides.css  (802ms)  (pid 15667)
Compiled jquery.fancybox.css  (0ms)  (pid 15667)
Compiled scaffolds.css  (8ms)  (pid 15667)
Compiled stores.css  (1ms)  (pid 15667)
Compiled application.css  (1001ms)  (pid 15667)


Started GET "/" for 190.166.197.58 at 2012-08-25 16:51:44 +0000
Processing by VisitorController#home as HTML
  Rendered visitor/home.html.erb within layouts/application (3.9ms)
Completed 500 Internal Server Error in 131ms

ActionView::Template::Error (visitor.css isn't precompiled):
    3: <head>
    4:   <title><%=h yield(:title) %></title>
    5:   <% if controller_name == "visitor" %>
    6:   <%= stylesheet_link_tag    "visitor", :media => "all" %>
    7:   <%= stylesheet_link_tag    "jquery.fancybox", :media => "all" %>
    8:   <%= javascript_include_tag "visitor" %>
    9:   <%= javascript_include_tag "jquery" %>
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___794713378064579018_17000980'

正如您所看到的,visitor.css 正在被编译,然后我得到了 visitor.css 没有预编译的错误。我在 application.css 中包含了 *=required 访问者。有什么问题?

4

1 回答 1

4

如果您*= require formtastic在 application.css 中需要 visitor.css ( ),那么您不需要自己包含它 ( <%= stylesheet_link_tag "visitor", :media => "all" %>)。

如果你不这样做,那么你必须将它添加到你的production.rb

config.assets.precompile += %w( visitor.css )
于 2012-08-25T17:36:23.147 回答