My app works fine when run in development environment. In production (rails server -e production), the browser can\'t access the css and js files and on the con
Check for a file like this:
public/assets/.sprockets-manifest-3f7771d777ceb581d754e4fad88aa69c.json
If you are pushing precompiled assets to a production server there is a chance that you are preventing hidden 'dot' files being pushed and this essential file won't make it into production.
In my environment I need to precompile assets in an integration environment and push these to production so that there is no need to compile the assets on the production machine. I was erroneously blocking all hidden files from being pushed to production machine.
To see if this answer works for you, check your generated HTML source in a browser from the production server to see if the assets path has been generated. If you see your script tag like this:
check the src attribute. It should start with /assets/javascript. In this case it starts with /javascript which indicates Rails does not think any of the assets have been precompiled.
I corrected this by updating my push to production (currently rsync), ensuring I push the .sprockets-manifest* file after precompiling on my integration server.
Also, I use standalone Passenger as my integration test server, rather than Webrick, since it handles more realistic serving of static files.