Skip to content
Anatoly Lapshin edited this page Feb 21, 2012 · 12 revisions

"Try Ruby" Tutorial

1. The Plan

... Describe what should be as a result of tutorial ...

2. New Rails app

Lets get started. First of all we have to make new rails application and add it to Github:

  $ rails new try-ruby --database=postgresql 
  $ cd try-ruby
  $ git add .
  $ git commit -m 'Initial commit'
  $ git remote add origin git@github.com:holywarez/try-ruby.git
  $ git push -u origin master

Ignore unnecessary IDE files:

  $ cat ".idea" >> .gitignore
  $ git commit -am 'gitignore updated'

Update database config to use trusted connection to Postgresql server:

  $ cat config/database.yml | sed -e 's/username: try-ruby/username: /g' > config/database.yml
  $ git commit -am 'simplify database conf'

3. Setup first UI

... Steps describe how to implement first version of UI for project ...

Add first controller: HomeController with 'index' action

  $ rails g controller Home index

And make it an entry point by replacing (config/routes.rb):

  get "home_controller/index"

with:

  root to: 'home#index', via: 'get'

Always check the result of changes of routes.rb:

  $ rake routes

Now output of this command should be:

S1

And don't forget to remove public/index.html

  $ rm public/index.html

Clone this wiki locally