routes.rb 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. Depot::Application.routes.draw do
  18. resources :orders
  19. resources :line_items
  20. resources :carts
  21. get "store/index"
  22. resources :products do
  23. get :who_bought, :on => :member
  24. end
  25. # ...
  26. # The priority is based upon order of creation:
  27. # first created -> highest priority.
  28. # Sample of regular route:
  29. # match 'products/:id' => 'catalog#view'
  30. # Keep in mind you can assign values other than :controller and :action
  31. # Sample of named route:
  32. # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  33. # This route can be invoked with purchase_url(:id => product.id)
  34. # Sample resource route (maps HTTP verbs to controller actions automatically):
  35. # resources :products
  36. # Sample resource route with options:
  37. # resources :products do
  38. # member do
  39. # get 'short'
  40. # post 'toggle'
  41. # end
  42. #
  43. # collection do
  44. # get 'sold'
  45. # end
  46. # end
  47. # Sample resource route with sub-resources:
  48. # resources :products do
  49. # resources :comments, :sales
  50. # resource :seller
  51. # end
  52. # Sample resource route with more complex sub-resources
  53. # resources :products do
  54. # resources :comments
  55. # resources :sales do
  56. # get 'recent', :on => :collection
  57. # end
  58. # end
  59. # Sample resource route within a namespace:
  60. # namespace :admin do
  61. # # Directs /admin/products/* to Admin::ProductsController
  62. # # (app/controllers/admin/products_controller.rb)
  63. # resources :products
  64. # end
  65. # You can have the root of your site routed with "root"
  66. # just remember to delete public/index.html.
  67. # root :to => "welcome#index"
  68. root :to => 'store#index', :as => 'store'
  69. # ...
  70. # See how all your routes lay out with "rake routes"
  71. # This is a legacy wild controller route that's not recommended for RESTful applications.
  72. # Note: This route will make all actions in every controller accessible via GET requests.
  73. # match ':controller(/:action(/:id(.:format)))'
  74. end