routes.rb 2.3 KB

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