config/routes.rb

使用環境
Ruby on Rails 2.2.2

map.root

map.root :controller => 'users'
root  / {:action=>"index", :controller=>"users"}

map.connect

map.connect 'articles/:year/:month/:day',
            :controller => 'articles',
            :action     => 'find_by_date',
            :year       => /\d{4}/,
            :month      => /\d{1,2}/,
            :day        => /\d{1,2}/
  /articles/:year/:month/:day {:action=>"find_by_date", :controller=>"articles"}

map.ルート名

map.new_session 'new_session', :controller => 'sessions', :action => 'new'
new_session  /new_session {:action=>"new", :controller=>"sessions"}

map.with_options

map.with_options :controller => 'blog' do |blog|
  blog.show    '',            :action  => 'list'
  blog.delete  'delete/:id',  :action  => 'delete'
  blog.edit    'edit/:id',    :action  => 'edit'
end
  show  /           {:action=>"list", :controller=>"blog"}
delete  /delete/:id {:action=>"delete", :controller=>"blog"}
  edit  /edit/:id   {:action=>"edit", :controller=>"blog"}

URLを丸ごとパラメータとして渡す

map.connect 'entry/*url', :controller => 'entry', :action => :list
  /entry/:url {:action=>:list, :controller=>"entry"}

routes.rbでURLを丸ごとパラメータとして渡す記述法 - Hello, world! - s21g

省略可能パラメータを指定する

map.connect 'for/:bar', :controller => 'foo', :action => 'show', :bar => 'default_value'
  /for/:bar {:action=>"show", :controller=>"foo"}

routes.rbで省略可能パラメータを指定する方法 - Hello, world! - s21g

map.resource

map.resource :com
               com POST   /com              {:action=>"create", :controller=>"coms"}
     formatted_com POST   /com.:format      {:action=>"create", :controller=>"coms"}
           new_com GET    /com/new          {:action=>"new", :controller=>"coms"}
 formatted_new_com GET    /com/new.:format  {:action=>"new", :controller=>"coms"}
          edit_com GET    /com/edit         {:action=>"edit", :controller=>"coms"}
formatted_edit_com GET    /com/edit.:format {:action=>"edit", :controller=>"coms"}
                   GET    /com              {:action=>"show", :controller=>"coms"}
                   GET    /com.:format      {:action=>"show", :controller=>"coms"}
                   PUT    /com              {:action=>"update", :controller=>"coms"}
                   PUT    /com.:format      {:action=>"update", :controller=>"coms"}
                   DELETE /com              {:action=>"destroy", :controller=>"coms"}
                   DELETE /com.:format      {:action=>"destroy", :controller=>"coms"}