Skip to content

Instantly share code, notes, and snippets.

@calumgunn
Created August 15, 2013 13:27
Show Gist options
  • Save calumgunn/6240805 to your computer and use it in GitHub Desktop.
Save calumgunn/6240805 to your computer and use it in GitHub Desktop.
Rails 4 assets trouble? Here you go.
Are your images disappearing when you deploy your Rails 4 app to Heroku? Mine were, but I think I figured it out. I don't claim to be any kind of Ruby on Rails expert, but after a lot of trial and error I found that these steps got my static assets uploading and displaying.
1. In your Gemfile:
gem 'rails_12factor', group: :production
Be sure to run 'bundle install' in your terminal after adding this (or any) gem.
2. In config/environments/production.rb, change these properties to 'true':
config.serve_static_assets = true
config.assets.compile = true
3. Run this line in your terminal:
RAILS_ENV=production bin/rake assets:precompile
4. Before deploying, make sure you run this command:
rake assets:precompile
After these four simple steps, you should be laughing all the way to Total Internet Fame. Good luck!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment