1

I'm deploying a rails application with AWS, Capistrano and Nginx. Everything worked fine except the assets.

The application is looking for the correct assets but the file names have the wrong hash.

Example: The site is looking for this: http://35.167.19.250/assets/application.self-afbcf52bc2ee07a55f9597f238014e6c33f9199949f2397157e6d2dc72d3dd0e.css?body=1 Failed to load resource: the server responded with a status of 404 (Not Found) But the actual file is that has been precompiled is: http://35.167.19.250/assets/application-fc0ac1dbdd04ee2388affcd3154154fb6c6d1b1a33298abb8cf281c15d4d4c56.css

Any ideas of where I'm going wrong?

Ben
  • 342
  • 5
  • 13

1 Answers1

2

If you're precompiling assets, you need to do it in production mode so that the fingerprints match.

See this SO thread for more details, but I think all you need to do is RAILS_ENV=production bundle exec rails assets:precompile.

Community
  • 1
  • 1
Brian
  • 5,300
  • 2
  • 26
  • 32
  • Hi Brian, Do i run this before I run my capistrano deployment or do I run this on the server after the files have been deployed? Thanks – Ben Jan 10 '17 at 19:09
  • 2
    Sorry, just saw this - I believe you would do it pre-deployment. – Brian Feb 01 '17 at 15:18