I have deployed this app (rails 3.2.11) a million times, I haven't messed with any settings, but now I'm greeted with this:
Why did this happen out of the blue? My conents of application.rb include config.assets.enabled = true
- never had any issues.
In fact running it locally on port 3000 seems to not have any issues whatsoever.
After deploying to heroku this morning, it seems that it loads nothing that's inside /assets/
Interestingly, after copying the files over to try and just make a new app, git commit
results in all the stuff you'd expect as well as a LONG list of these which I think might be related:
Edit: Interestingly enough SOME of the assets have loaded, like the logo and the background, but the rest as you can see return 404.
Rails recommended that this setting
config.serve_static_assets
by default should be disabled i.e. set to false. Here is the default configuration inconfig/environments/production.rb
generated in rails appDisable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
So if you are setting it to true in your local app then that's still fine. But if you are deploying your app on Apache or ngix or anything other than heroku then its not advisable to make
config.serve_static_assets=true
in your production.rb config file. Here is the documentation from Rails guides.URL - http://guides.rubyonrails.org/configuring.html
Heroku released a gem to handle the assets without needing to turn off compilation or to manually compile.
https://devcenter.heroku.com/articles/ruby-support#static-assets
Just add this to your Gemfile and redeploy.
For Rails 4, use:
config.serve_static_assets = true
The default was false. We needed this after removing the rails_12factor gem.
I had this problem today with rails 4 on heroku. The article provided by @Jeff is a little bit old but, the gem repository has a good readme. Summarizing, you will need to add two gems to your Gemfile:
gem 'rails_serve_static_assets'
(it will solve the static assets problem) andgem 'rails_stdout_logging'
(which the previous one depends on).put line in config/environments/production.rb
it worked as it will compile the assets on runtime, just like in development environment, but its makes application slow, the best way is to either compile the assets locally in production environment with rake task(RAILS_ENV=production bundle exec rake assets:precompile) and commit your generated assets in public/assets and then do deployment. or, heroku run rake assets:precompile
To make the assets to load with the corresponding fingerprint of each file verify the configuration
config/environments/production.rb
has the instruction:ruby # Load assets with fingerprint behavior config.assets.digest = true