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