Sign up for a Heroku account and install the toolbelt if you haven't already.
In your Gemfile, add
group :production do
gem 'pg'
gem 'rails_12factor'
end
and replace
gem 'sqlite3'
with
group :development do
gem 'sqlite3'
end
At the very top of the file, include your Ruby version number:
ruby '2.2.0'
Next, from the command line,
bundle install --without production
Finally, commit these changes using the Desktop App or from the command line:
git add .
git commit -m "Heroku changes"
From the command line,
heroku create your-app-name-here
If the name is available, you will get a URL of http://your-app-name-here.herokuapp.com. If not, try again.
From the command line,
git push heroku master
It may take a while for Heroku to receive your code, detect that it is a Rails application, bundle install, and deploy. Once finished you should be able to visit your site with the shorcut
heroku open
You still need to migrate your database and other setup tasks. Prefix any commands that you want to run on your Heroku machine with heroku run. For example,
heroku run rake db:migrate
heroku run rake db:seed
heroku run rails c
Note: if you used a column type of
belongs_towhen generating scaffolds with foreign key columns, AND you used a non-conventional name for them, you will need to modify your migration files. TODO complete this.
To see what's happening on your production server log,
heroku logs --tail