0

I am deploying a RoR 3.2 app to a shared server.

When I run rake assets:precompile RAILS_ENV=production I can see at ~/public_html/my_app/assets/ that all my images are precompiled.

But when I go to mywebsite.com ActionView throws an error. The production log gives me:

ActionView::Template::Error (200/adrap21.png isn't precompiled).

Funny thing is that at ~/public_html/my_app/assets/200 I can see a precompiled image: adrap21-a5f042dd2b89a3d87eba25969495d678.png

I have run several times one of the following:

1) rake assets:precompile RAILS_ENV=production

2) RAILS_ENV=production rake assets:precompile

at my_app/config/environments/production.rb I have the following:

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false

# Compress JavaScripts and CSS
config.assets.compress = true

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

I have changed config.assets.compile from false to true and does not help.

I have read related answers but other people solutions are not working for me.

This one was suposed to be foolproof. Another one, more specific about not compiling images, this other prevents using config.assets.compile = true.

I have even tried the advice of using config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif] , but it is not yet working. Might there be something wrong with images call? Is it a RoR 3.2 bug?

Community
  • 1
  • 1
Dieglock
  • 169
  • 1
  • 16
  • how you are calling the image ? – Paritosh Piplewar Mar 06 '14 at 23:40
  • This is an example of the image calling: <%= image_tag("200/adrap21.png", :alt => "no avatar", :class => "pull-left p_15 mr_25")... But it was not my code. This morning I visited the website to fix it and it was working without me doing anything. I think it was Phusion Passenger creating the problem. Something on hosting setup. Thanks anyhow, Paritosh. – Dieglock Mar 08 '14 at 18:59

1 Answers1

0

FOUND WHAT THE PROBLEM WAS.

Phusion Passenger needs to be restarted for the compiled assets to work. That is why, using Capistrano, you need to restart the server for all the compiled to work together.

Thanks again, Paritosh. I know too how slow is learning curve at beginning when you learn to program by yourself.

Dieglock
  • 169
  • 1
  • 16