簡體   English   中英

500 內部服務器錯誤 - ActionView::Template::Rails 生產中的錯誤

[英]500 Internal Server Error - ActionView::Template::Error in Rails Production

我在我的生產 Rails 站點上收到 500 內部服務器錯誤,這就是我在日志/生產.log 上看到的。 令人驚訝的是,代碼在開發中的本地服務器上工作

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;
}

推送到生產時需要預編譯資產

bundle exec rake assets:precompile

另外,閱讀資產管道文檔一些,值得您花時間

對於像我這樣的人,他們在出現類似錯誤后最終出現在這里,但沒有堆棧跟蹤:gem better_errors為我提供了解決問題的信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM