【Rails5】The asset is not present in the asset pipeline が出た時の対処法

どうもKanoeです。
開発中のRails アプリをHeroku上で実行しようとしたら毎度おなじみの “We’re sorry, but something went wrong.” が出てアプリが開けなくなりました。

今回はログを確認すると以下のようなエラーが出ていました。

2019-00-00T00:00:00.000000+00:00 app[web.1]: 
  F, [2019-00-00T00:00:00.000000 #0] FATAL -- : 
  [00000000-0000-0000-0000-000000000000] ActionView::Template::Error (The asset "〇〇.jpeg" is not present in the asset pipeline.):

どうやら asset へのパイプラインがうまく行ってない模様

ここで確認するのは、config/envitonments/production.rb

どこかに config.assets.compile って項目があるので、true にします。

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true

これで再び Heroku にプッシュしてあげると改善していると思います。

これでもうまくいかないと言う方は下記のリンク等参考にしてみるといいかもしれません。

Rails Asset Pipelineがうまくいかないときの問題の切り分けかた - Qiita