Rails Noob's Notes

Because my memory is good but short.

Heroku

Installation

This installation description is for Ubuntu.

Create an account on https://www.heroku.com/ if you don't have one.

Go on https://toolbelt.heroku.com/ and install Heroku client.

wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

Or

sudo apt-get install heroku

Log in.

heroku login

To uninstall use

sudo apt-get purge heroku

Deploy a rails application

Creating a heroku project

You must be in the project directory.

heroku create unique-app-name

Or just

heroku create To let heroku create a random name for you.

You can change the name with heroku rename the-new-name-for-app.

Prepering the application

Add your ruby version to the Gemfile.

ruby '2.2.1'

Move 'sqlite3' gem from the global space to the development and test groups.

group :development, :test do
  gem 'sqlite3'
end

Add gems 'pg' and rails_12factor' to the production grop.

group :production do
  gem 'pg', '~> 0.18.4'
  gem 'rails_12factor', '~> 0.0.3'
end

Execute gem changes.

bundle --without production

In view files instead of "logo.png" use <%= asset_path("logo.png") %>.

Upload to Heroku

Make a commit.

git add .

git commit -m"Some comment"

Push the app to heroku.

git push heroku master

Run migrations on heroku.

heroku run rake db:migrate