[12] | 1 | ActionController::Routing::Routes.draw do |map|
|
---|
[60] | 2 | map.resources :people
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | map.resources :people
|
---|
| 6 |
|
---|
[12] | 7 | # The priority is based upon order of creation: first created -> highest priority.
|
---|
| 8 |
|
---|
| 9 | # Sample of regular route:
|
---|
| 10 | # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
---|
| 11 | # Keep in mind you can assign values other than :controller and :action
|
---|
| 12 |
|
---|
| 13 | # Sample of named route:
|
---|
| 14 | # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
---|
| 15 | # This route can be invoked with purchase_url(:id => product.id)
|
---|
| 16 |
|
---|
| 17 | # Sample resource route (maps HTTP verbs to controller actions automatically):
|
---|
| 18 | # map.resources :products
|
---|
| 19 |
|
---|
| 20 | # Sample resource route with options:
|
---|
| 21 | # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
---|
| 22 |
|
---|
| 23 | # Sample resource route with sub-resources:
|
---|
| 24 | # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
---|
| 25 |
|
---|
| 26 | # Sample resource route within a namespace:
|
---|
| 27 | # map.namespace :admin do |admin|
|
---|
| 28 | # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
---|
| 29 | # admin.resources :products
|
---|
| 30 | # end
|
---|
| 31 |
|
---|
| 32 | # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
---|
| 33 | # map.root :controller => "welcome"
|
---|
| 34 |
|
---|
| 35 | # See how all your routes lay out with "rake routes"
|
---|
| 36 |
|
---|
| 37 | # Install the default routes as the lowest priority.
|
---|
| 38 | map.connect ':controller/:action/:id'
|
---|
| 39 | map.connect ':controller/:action/:id.:format'
|
---|
| 40 | end
|
---|