この記事について
本番環境でbackground-imageの画像を読み込む時にはエラーが出ないのに、image_tagのところだけでエラーが出てしまっていたので、そのエラー解決方法について
環境
・Ruby 2.6.6, Rails 6.0.3.2
・Docker,Docker-compose(開発環境)
・AWS/本番環境(EC2, RDS, VPC, EIP, Route53, IAM, S3)
参考URL
https://stackoverflow.com/questions/49440304/rails-asset-is-not-present-in-asset-pipeline-when-using-image-tag
この人と全く同じ現象になってました。
出ていたエラー
qiita.rb
ActionView::Template::Error (The asset "chat_example.jpeg" is not present in the asset pipeline.):
asset へのパイプラインがうまくいっていない様子
解決方法
config/environments/production.rbにある、config.assets.compile = falseをtrueに変えてあげる。
config/environments/production.rb
- config.assets.compile = false
+ config.assets.compile = true