Guest User

Untitled

a guest
May 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. # The priority is based upon order of creation: first created -> highest priority.
  2.  
  3. # Sample of regular route:
  4. map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  5. # Keep in mind you can assign values other than :controller and :action
  6.  
  7. # Sample of named route:
  8. map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  9. # This route can be invoked with purchase_url(:id => product.id)
  10.  
  11. # Sample resource route (maps HTTP verbs to controller actions automatically):
  12. map.resources :products
  13.  
  14. # Sample resource route with options:
  15. map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
  16.  
  17. # Sample resource route with sub-resources:
  18. map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  19.  
  20. # Sample resource route with more complex sub-resources
  21. map.resources :products do |products|
  22. products.resources :comments
  23. products.resources :sales, :collection => { :recent => :get }
  24. end
  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. # Note: These default routes make all actions in every controller accessible via GET requests. You should
  39. # consider removing the them or commenting them out if you're using named routes and resources.
Add Comment
Please, Sign In to add comment