1

本番レールサイトで500の内部サーバーエラーが発生します。これは、logs/production.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;
}
4

2 に答える 2

4

本番環境にプッシュするときにアセットをプリコンパイルする必要があります

bundle exec rake assets:precompile

また、アセットパイプラインのドキュメントを読んでください。時間の価値があります。

于 2013-03-24T07:48:35.597 に答える
0

同様のエラーの後でここに到達するが、スタックトレースがない私のような人々の場合、gembetter_errorsは問題を修正するための情報を私に提供してくれました。

于 2020-05-18T14:38:42.713 に答える