91s

プログラミング関係、日記などを書きます

activeadminでcssが読み込まれない(staging, production環境)

記事を書いた動機

  • staging環境(productionと同じ設定)を作成しているとき、activeadminのcss(たぶんjsも)が読み込まれなくて困った

起きたことと解決法

The asset "active_admin.css" is not present in the asset pipeline.

  • 原因:assets:precompileを忘れていた
  • 解決法:assets:precompileを実行
    • ECSなのでDockerfileにRUN DB_ADAPTER=nulldb bundle exec rails assets:precompileを追加

ActionController::RoutingError (No route matches [GET] "/assets/admin/active_admin-●●.css

  • 原因:まだ理解しきってないので書けません
  • 解決法:config/enviroments/staging.rbのconfig.public_file_server.enabledをtrueに変更