Ruby on Rails routing can be a little confusing. Here are some of the high points.
The root path is specified by the 'root' method. It matches the '/' path and behaves like 'match'.
The 'match' method will match the requested path to the string passed to match and route to the controller and action specified.
# Sends requests to /users/list to PeopleController#index
match "users/list", :to => "people#index"
You can also extract variables from the path.
# Matches /user/1/edit and passes '1' in params[:id]
match "users/:id/edit", :to => "users#edit"
You can specify which HTTP request methods are valid for a route.
get "users/index"
match "users/index", :to => "users#index", :via => :get
You can also name a route and use the related helper methods.
match "users/index", :to => "users#index", :as => "user_index"
#In some controller or view
user_index_path
# => "/users/index"
user_index_url
# => "http://localhost:3000/users/index"
You can also create RESTful resources around a model. See the Rails Guides for details.
resource :user
Finally, you can add to a RESTful resource when needed.
# allows you to post to '/users/1/make_admin' and get '/users/show_admins'
resource :user do
post :make_admin, :on => :member
get :show_admins, :on => :collection
end