# config/database.yml
development: # 開發用
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000
test: # 測試用
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000
production: # 上線用
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000
# config/routes.rb

get "welcome" => "welcome#index"
# 代表http://localhost:3000/welcome 會對應到 welcome Controller的index Action。 



resources :events
# 會自動生成四個四個命名路由(named routes),搭配四個HTTP動詞,對應到七個Actions,如下:
get    '/events'          => "events#index",   :as => "events"
post   '/events'          => "events#create",  :as => "events"
get    '/events/:id'      => "events#show",    :as => "event"
put    '/events/:id'      => "events#update",  :as => "event"
delete '/events/:id'      => "events#destroy", :as => "event"
get    '/events/new'      => "events#new",     :as => "new_event"
get    '/events/:id/edit' => "events#edit",    :as => "edit_event"



# get 是純讀取資料,對資料不會有任何影響,所以get資料可以回上一頁、refresh都ok;post則反之。
# HTML只有get、post,而Rails在post加上隱藏參數_method=PUT、_method=DELETE,就多了put、delete能用了。
# <% 執行但不輸出
# <%= 輸出值

<% @people.each  do |p| %>
	<%= p.name %>
<% end  %>
render 回傳使用的樣版(資料不會遺失)
redirect_to 重新導向action

Reference: http://ihower.tw/rails3/index.html