routes.rb 2.0 KB

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