routes.rb 2.5 KB

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