Skip to content

Instantly share code, notes, and snippets.

@andrewfritz86
Created February 17, 2015 15:30
Show Gist options
  • Save andrewfritz86/196c201b56f09e919ed7 to your computer and use it in GitHub Desktop.
Save andrewfritz86/196c201b56f09e919ed7 to your computer and use it in GitHub Desktop.
Rails and Heroku

#Hosting a Rails Application on Heroku

####Prior Information

####Push to Heroku

  • Add the rails_12factor gem to your Gemfile.
    • bundle install
  • Start with your basic Terminal and Heroku commands, you should know these from pushing Sinatra appications to Heroku
    • git init
    • git add -A
    • git commit -m "my first commit"
    • heroku create
  • Something to consider if you are having an asset precompile issue
    • Run rake assets:clean in your Terminal to get rid of any previously precompiled assets
    • In your config/application.rb put the following: config.assets.initialize_on_precompile = false
    • This will change how your Rails application precompiles its assets. It can be helpful because Heroku will attempt to precompile your assets and not having the above line in your code can conflict with how Heroku wants to do the precompile.
  • How do we get our tables into our database on Heroku?
    • heroku run rake db:migrate
  • How do we populate our tables from a seed file?
    • heroku run rake db:seed
  • Helpful commands:
    • heroku run rails console will allow you to use a rails console with the application on Heroku
    • heroku pg:psql will launch your Terminal into your Heroku application's Postgres database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment