2005-02-14 20:45:35 -05:00
|
|
|
ActionController::Routing::Routes.draw do |map|
|
|
|
|
# The priority is based upon order of creation: first created -> highest priority.
|
2007-05-27 14:44:33 -04:00
|
|
|
|
2006-03-20 01:20:18 -05:00
|
|
|
# Sample of regular route:
|
2007-09-20 19:16:06 -04:00
|
|
|
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
2005-02-14 20:45:35 -05:00
|
|
|
# Keep in mind you can assign values other than :controller and :action
|
2005-02-20 05:55:08 -05:00
|
|
|
|
2006-03-20 01:20:18 -05:00
|
|
|
# Sample of named route:
|
2007-09-20 19:16:06 -04:00
|
|
|
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
2006-03-20 01:20:18 -05:00
|
|
|
# This route can be invoked with purchase_url(:id => product.id)
|
2007-05-27 14:44:33 -04:00
|
|
|
|
2006-12-03 19:12:00 -05:00
|
|
|
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
2007-09-20 19:16:06 -04:00
|
|
|
# map.resources :products
|
2006-12-03 19:12:00 -05:00
|
|
|
|
|
|
|
# Sample resource route with options:
|
2007-09-20 19:16:06 -04:00
|
|
|
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
2006-03-20 01:20:18 -05:00
|
|
|
|
2007-04-29 10:05:34 -04:00
|
|
|
# Sample resource route with sub-resources:
|
2007-09-20 19:16:06 -04:00
|
|
|
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
|
|
|
|
|
|
|
# Sample resource route within a namespace:
|
|
|
|
# map.namespace :admin do |admin|
|
|
|
|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
|
|
|
# admin.resources :products
|
|
|
|
# end
|
2007-04-29 10:05:34 -04:00
|
|
|
|
|
|
|
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
2006-12-03 19:12:00 -05:00
|
|
|
# map.root :controller => "welcome"
|
2005-03-20 18:39:07 -05:00
|
|
|
|
2007-09-20 19:16:06 -04:00
|
|
|
# See how all your routes lay out with "rake routes"
|
|
|
|
|
2007-04-24 18:25:41 -04:00
|
|
|
# Install the default routes as the lowest priority.
|
2005-02-14 20:45:35 -05:00
|
|
|
map.connect ':controller/:action/:id'
|
2007-04-24 18:25:41 -04:00
|
|
|
map.connect ':controller/:action/:id.:format'
|
2007-05-27 14:44:33 -04:00
|
|
|
end
|