routes.rb 2.1 KB

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