Images damaged after loading the Rails application in the hero

Shows a fine locally. But when I boot into Heroku, I get the following:

enter image description here

<%= image_tag('logo-red.png') %> 

and it is in assets / images /

I do not use Turbolinks. Do I need to run a team on Heroku to solve this problem or is there some kind of configuration setting that I skip?

edit 1: tried to start heroku run rake assets:precompile RAILS_ENV=production

edit 2: response from character to hero:

It looks like your application is compiling this image correctly: ~ / public / assets $ pwd / application / state / assets ~ / public / assets $ ls | grep logo-red logo-red-a07050d882e1dba431cef2130d39f929c611eaf8b0ec3c50db0742ddccb14d93.png

edit 3: see attached screenshot enter image description here

+8
ruby-on-rails heroku asset-pipeline
source share
3 answers

Try running on the local computer:

 rake assets:precompile rake assets:clean 

Then lock and click on the hero.

Also check the production.rb file and make sure that everything related to compilation or precompilation is true and not false, i.e.:

 config.serve_static_assets = true config.assets.compile = true 

Also, make sure that rails_12factor is in your gem file like this:

 gem 'rails_12factor', group: :production 
+7
source share

If this problem was on Herek before, we decided to use it precompiling assets of Heroku himself:

 $ heroku run rake assets:precompile RAILS_ENV=production 

I know this is done when you click the repo on Geroku; this is one of those quirks that seems to be resolved if you compile the assets on your server.

You can also precompile locally until you verify that RAILS_ENV is a product:

$ rake assets:precompile RAILS_ENV=production

+2
source share

After the answer below, if your problem is still ongoing

try:

 <%= asset_path 'logo-red.png' %> 
0
source share

All Articles