routes.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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
  15. # The priority is based upon order of creation:
  16. # first created -> highest priority.
  17. # See how all your routes lay out with "rake routes".
  18. # You can have the root of your site routed with "root"
  19. root 'store#index', as: 'store'
  20. # ...
  21. # Example of regular route:
  22. # get 'products/:id' => 'catalog#view'
  23. # Example of named route that can be invoked with purchase_url(id: product.id)
  24. # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
  25. # Example resource route (maps HTTP verbs to controller actions automatically):
  26. # resources :products
  27. # Example resource route with options:
  28. # resources :products do
  29. # member do
  30. # get 'short'
  31. # post 'toggle'
  32. # end
  33. #
  34. # collection do
  35. # get 'sold'
  36. # end
  37. # end
  38. # Example resource route with sub-resources:
  39. # resources :products do
  40. # resources :comments, :sales
  41. # resource :seller
  42. # end
  43. # Example resource route with more complex sub-resources:
  44. # resources :products do
  45. # resources :comments
  46. # resources :sales do
  47. # get 'recent', on: :collection
  48. # end
  49. # end
  50. # Example resource route with concerns:
  51. # concern :toggleable do
  52. # post 'toggle'
  53. # end
  54. # resources :posts, concerns: :toggleable
  55. # resources :photos, concerns: :toggleable
  56. # Example resource route within a namespace:
  57. # namespace :admin do
  58. # # Directs /admin/products/* to Admin::ProductsController
  59. # # (app/controllers/admin/products_controller.rb)
  60. # resources :products
  61. # end
  62. end