routes.rb 2.0 KB

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