Rails can't load (404 error) CSS & JS files on production but has no problem loading them in development.
I'm using Capistrano for deployment and running Rails 3. My path on development is /www/myapp but my path on production is /www/myapp/current.
The application itself seems to work fine, so the issue seems to be isolated to CSS/JS files.
I tried setting the RAILS_ROOT variable to /www/myapp/current in environments/production.rb but it did not make any difference, the files still don't load.
Here's the full stack from the production log:
Started GET "/stylesheets/scaffold.css?1280867531" for 98.173.61.21 at 2010-08-04 17:04:05 -0700
ActionController::RoutingError (No route matches "/stylesheets/scaffold.css"):
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/show_exceptions.rb:55:in `call'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0.beta4/lib/rails/rack/logger.rb:14:in `call'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/rack-1.1.0/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/rack-1.1.0/lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0.beta4/lib/rails/application.rb:145:in `call'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/railties-3.0.0.beta4/lib/rails/application.rb:81:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:642:in `process_client'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:715:in `block in worker_loop'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:713:in `each'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:713:in `worker_loop'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:604:in `block (2 levels) in spawn_missing_workers'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:601:in `fork'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:601:in `block in spawn_missing_workers'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:597:in `each'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:597:in `spawn_missing_workers'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:611:in `maintain_worker_count'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:270:in `start'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/lib/unicorn.rb:29:in `run'
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/unicorn-1.1.2/bin/unicorn:123:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-rc2/bin/unicorn:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-rc2/bin/unicorn:19:in `<main>'