Rails 3.1 has transformed the actual way it handles the resource pipeline which is leading to issues when implementing to production.

I'm using Apache and Passenger, which appear to operate fine.

My production is setup such as this (for the time being).

# congif/environments/production.rb
config.cache_classes = false
config.consider_all_requests_local       = true
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache

I run rake assets:precompile on Ubuntu and begin server. And... nothing. None of my images load.

The legendary 'I aren't able to find a picture only at that URL' box.

I run rake assets:precompile on CentOS and begin server. And... permission errors.

*Error Compiling CSS Asset*
Errno::EACCESS: Permission Denied - [app path]/tmp/cache/assets/E95
[path to RVM Ruby]/fileutils.rb:243:in 'mkdir'

I can not have it to budge. Any assistance is greatly appreciated. Thanks!


This solution has labored each time for me personally:

First Cleanse your Assets

rm -rf public/assets


rake assets:clean RAILS_ENV=production

Second, in #production.rb change

config.assets.compile = false


config.assets.compile = true

Third, go to precompile your assets

rake assets:precompile RAILS_ENV=production

4th, in #production.rb change

config.assets.compile = true


config.assets.compile = false

Fifth, restart your server by running:

touch tmp/restart.txt

Sixth, not-restrict permissions in your recently produced assets by running this command

chmod -R 777 public/assets

Seventh, celebrate!!

Try creating public/assets via sudo or try carrying out rvmsudo rake assets:precompile - basically, it's unable to produce the directory in your server &mdash hence the mistake.

This is a simple permission problem. Provide the server/daemon the authority to create files in [application_path]/tmp recursively.

Presuming your server process runs using the www-data user you need to do this with:

chmod -R u+w tmp

and when your directory doesn't fit in with the consumer you need to alter the possession:

chown -R www-data tmp