routes.rb 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. #---
  10. # Excerpted from "Agile Web Development with Rails, 4rd Ed.",
  11. # published by The Pragmatic Bookshelf.
  12. # Copyrights apply to this code. It may not be used to create training material,
  13. # courses, books, articles, and the like. Contact us if you are in doubt.
  14. # We make no guarantees that this code is fit for any purpose.
  15. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  16. #---
  17. ActionController::Routing::Routes.draw do |map|
  18. # The priority is based upon order of creation: first created -> highest priority.
  19. # Sample of regular route:
  20. # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  21. # Keep in mind you can assign values other than :controller and :action
  22. # Sample of named route:
  23. # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  24. # This route can be invoked with purchase_url(:id => product.id)
  25. # Sample resource route (maps HTTP verbs to controller actions automatically):
  26. # map.resources :products
  27. # Sample resource route with options:
  28. # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
  29. # Sample resource route with sub-resources:
  30. # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  31. # Sample resource route with more complex sub-resources
  32. # map.resources :products do |products|
  33. # products.resources :comments
  34. # products.resources :sales, :collection => { :recent => :get }
  35. # end
  36. # Sample resource route within a namespace:
  37. # map.namespace :admin do |admin|
  38. # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  39. # admin.resources :products
  40. # end
  41. # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  42. # map.root :controller => "welcome"
  43. # See how all your routes lay out with "rake routes"
  44. # Install the default routes as the lowest priority.
  45. # Note: These default routes make all actions in every controller accessible via GET requests. You should
  46. # consider removing or commenting them out if you're using named routes and resources.
  47. map.connect ':controller/:action/:id'
  48. map.connect ':controller/:action/:id.:format'
  49. end