2013-03-24 28 views
1

我在生产导轨网站上收到500内部服务器错误,这是我在logs/production.log上看到的。令人惊讶的代码在开发中的本地服务器上工作500内部服务器错误 - 导轨生产中的ActionView :: Template :: Error

Completed 500 Internal Server Error in 11745ms 

ActionView::Template::Error (undefined method `[]' for nil:NilClass 
    (in /home/jason/public_html/site/app/assets/stylesheets/application.css)): 
    8:  
    9:  <%= csrf_meta_tags %> 
    10: 
    11:  <%= stylesheet_link_tag "application", :media => "all" %> 
    12: 
    13: </head> 
    14: <body> 
    app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb__243082314235891573_4889460' 
    app/controllers/main_controller.rb:18:in `index' 

我在这里迷路了,有什么帮助吗?

这里是Application.css

/* You're free to add application-wide styles to this file and they'll appear at the top of the 
* compiled file, but it's generally better to create a new file per style scope. 
* 
*= require_tree . 
*= require_self 
*/ 

/* Main Body */ 

body { 
    background: #f3f3f3; 
} 
+1

也许你需要在推向生产时预先编译资产 – fengd 2013-03-24 07:30:40

+0

@ Jun1st-如何在生产环境中预编译资产? – iCyborg 2013-03-24 07:37:35

+0

bundle exec rake资源:预编译。你应该把“如何预编译...”放到谷歌搜索框中,而不是在这里询问:) – fengd 2013-03-24 07:41:39

回答

3

需要预编译的资产当推到生产

bundle exec rake assets:precompile 

也,读asset pipeline DOC一些,值得你花时间

+0

我运行bundle exec rake assets:precompile,但得到这个错误“rake aborted!undefined method'[ ]'为nil:NilClass(在/home/jason/public_html/mysite/app/assets/stylesheets/application.css)“,所以基本上与上面相同的错误。 – iCyborg 2013-03-24 09:05:00

+0

终于我得到它解决,谢谢,我当然要通过资产管道,以充分了解它 – iCyborg 2013-03-24 11:27:56

+1

高兴你修好了:) – fengd 2013-03-24 15:19:17

相关问题