Shows fine locally. But when I upload to Heroku, I get the following:
<%= image_tag('logo-red.png') %>
and it's located in assets/images/
I'm not using Turbolinks. Do I need to run a command on Heroku to solve this or is there some config setting I'm missing?
edit 1: tried running heroku run rake assets:precompile RAILS_ENV=production
edit 2: response from heroku staff:
It looks like your app is properly compiling that image: ~/public/assets $ pwd /app/public/assets ~/public/assets $ ls | grep logo-red logo-red-a07050d882e1dba431cef2130d39f929c611eaf8b0ec3c50db0742ddccb14d93.png
edit 3: See attached screenshot
Try running on your local computer:
rake assets:precompile
rake assets:clean
Then commit and push to heroku.
Also check your production.rb
file and make sure everything related to compiling or precompiling is true and not false ie:
config.serve_static_assets = true
config.assets.compile = true
Also, make sure rails_12factor is in your gemfile like so:
gem 'rails_12factor', group: :production
Had this problem on Heroku before - we solved it by precompiling
the assets on Heroku itself:
$ heroku run rake assets:precompile RAILS_ENV=production
I know this is done when you push the repo to Heroku; it's one of those quirks which seems to be resolved if you compile the assets on their server.
You could also precompile locally as long as you make sure the RAILS_ENV
is production:
$ rake assets:precompile RAILS_ENV=production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With