Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does stylesheet_link_tag not link to /assets in production?

I just did the first deploy for a new Rails 3.1 application, but the assets don't seem to work correctly. I'm precompiling everything upon deploy, and it turns up in public/assets like expected. However, the output of for example stylesheet_link_tag "application" in my layout has a href pointing to /stylesheets/application.css. This obviously does not work.

The strange thing is that in development mode everything seems to be fine, it links to /assets/application.css like expected.

I've compared my config/application.rb and config/environments/production.rb files with another app we have on the asset pipeline, and the relevant settings seem to be the same.

Where should I look?

like image 306
Marten Veldthuis Avatar asked Jan 11 '12 18:01

Marten Veldthuis


1 Answers

When the helper generates this code:

/stylesheets/application.css

This is because the pipeline is NOT enabled in whatever mode you are in. There are several possible reasons.

  • You have the pipeline enabled in the wrong config file. (The pipeline should be enabled in the application.rb config file)

  • You have it enabled in application.rb and disabled somewhere else.

  • You have accidentally commented out a railtie somewhere

See this question for details.

If this is an upgraded app, check all the config options in the last section of the pipeline guide to make sure that you have them all correctly set.

like image 169
Richard Hulse Avatar answered Oct 13 '22 01:10

Richard Hulse