Starting Ruby On Rails - DAY 1
From Logic Wiki
To Create Basic Structure
rails new <ProjectName>
To Start Web Server
rails s
To Generate Controller and View
rails generate controller <ControllerName> <ViewName>
To ReRoute to new Home Page
open /config/routes.rb
add the line below
root :to =>'home#index'
You may need to delete view/layout/application.html.erb
Heroku
- Create an account
- Start a Ruby Project
- install toolbelt
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
- login to heroku
heroku login Enter your Heroku credentials. Email: ali.iybar@gmail.com Password:C1pralex Authentication successful.
- login to Github
- create repository
- Push app to github
- create heroku app
heroku create
- install postgreSQL if not exists
sudo apt-get install postgresql
- Assign a full right user
sudo -u postgres createuser ali
- remove sqlite gem
- open Gemfile from root directory of the project
- change gem 'sqlite' with gem 'pg'
- run
gem install pg -v '0.18.2'
- run
bundle install
- convert config/database.yml and change
adapter: sqlite3
with
adapter: postgresql
- check if it's working correctly
psql
- push heroku branch
git push heroku master