routes.rb 2.9 KB

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