routes.rb 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. require './config/routes_with_conditions'
  18. ActionController::Routing::Routes.draw do |map|
  19. # The priority is based upon order of creation: first created -> highest priority.
  20. # Sample of regular route:
  21. # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  22. # Keep in mind you can assign values other than :controller and :action
  23. # Sample of named route:
  24. # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  25. # This route can be invoked with purchase_url(:id => product.id)
  26. # Sample resource route (maps HTTP verbs to controller actions automatically):
  27. # map.resources :products
  28. # Sample resource route with options:
  29. # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
  30. # Sample resource route with sub-resources:
  31. # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  32. # Sample resource route with more complex sub-resources
  33. # map.resources :products do |products|
  34. # products.resources :comments
  35. # products.resources :sales, :collection => { :recent => :get }
  36. # end
  37. # Sample resource route within a namespace:
  38. # map.namespace :admin do |admin|
  39. # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  40. # admin.resources :products
  41. # end
  42. # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  43. # map.root :controller => "welcome"
  44. # See how all your routes lay out with "rake routes"
  45. # Install the default routes as the lowest priority.
  46. # Note: These default routes make all actions in every controller accessible via GET requests. You should
  47. # consider removing the them or commenting them out if you're using named routes and resources.
  48. map.connect ':controller/:action/:id'
  49. map.connect ':controller/:action/:id.:format'
  50. end