LoginSignup
0
1

More than 3 years have passed since last update.

Rails 本番環境で画像が読み込まれないエラー

Posted at

この記事について

本番環境で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
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1