### Deploying to Heroku
* Create your rails app
* Run your completed app on the browser using `rails s` to ensure the site is working
* Add `git init` to your repo
* Run `gem install heroku`
* run `heroku` for manual, `heroku help ___` for more information
* To create your sub-domain: `heroku create sub-domain-name`
* If you don't provide a name, heroku will generate one for you
* **Make sure you have an account with heroku before you push your repo to it!**
* After creating account, you can push to heroku: `git push heroku master`
* Make sure you specify which branch to push to heroku!
* Once heroku is done installing all the gems, it will provide you with the link to access your site.
* Copy and paste the link in to your broswer or type in the terminal: `heroku open` to launch
the site.
* At this point, you can run your migrations and seeded data locally for the SQLite DB.
### Connecting to your app
* `heroku git:remote -a app-name`
### Errors with SQLite DB
* After completing the steps above, you will encounter errors preventing your page from loading.
* You can check `heroku logs` to find the error:
* `ActiveRecord::ConnectionNotEstablished ...` => need to migrate your database!!!!
* Run `heroku rake db:migrate`
* Error: `Please install the postgresql adapter`
* **HEROKU DOES NOT WORK WITH SQLITE!!!**
* Edit`Gemfile`:
```ruby
group :test do
...
end
#ADD this new code
group :production do
gem 'pg'
end
```
* Run `bundle`
* Update heroku with the new file changes, `git add . git commit -m " "`
* Run `git push heroku master` or the name of your branch that you are working on
* You'll need to run the migrations again, now that you have the appropriate database
* `heroku rake db:migrate`
* Tables should successfully be created at this point!
* ERROR: If you encounter `ActionView::Template::Error (application.css isn't precompiled):`
* run `bundle exec rake assets:precompile`
* Add and commit to `git push heroku master`
* Or pushing from another branch: `git push heroku yourbranch:master`
### Transferring Date from SQLite DB to PostgreSQL DB
* Reload page, should not encounter any other errors.
* You're site contains an empty DB, to transfer data over:
* Make sure you have `taps` gem installed! `gem install taps`
* Run `heroku db:push`
* The log should indicate the number of tables and records uploaded