Guest User

Untitled

a guest
Jun 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. ##hellow.rhtml
  2.  
  3. <head>
  4. <body>
  5. time is now
  6. <%= @time %>
  7. <br>
  8. <%= link_to "to goodbye.rhtml", :action => "goodbye" %>
  9. </body>
  10. </head>
  11.  
  12. ##goodbye.rhtml
  13. <head>
  14. <body>
  15. bla bal
  16. <%= link_to "hello", :action => "hellow" %>
  17. </body>
  18. </head>
  19.  
  20. ##mycontr_controller.rb
  21. class MycontrController < ApplicationController
  22. def hellow
  23. @time = Time.now
  24. end
  25.  
  26. def goodbye
  27. @time = Time.now
  28. end
  29. end
  30.  
  31. ##config/routes.rb
  32. ActionController::Routing::Routes.draw do |map|
  33. # The priority is based upon order of creation: first created -> highest priority.
  34.  
  35. # Sample of regular route:
  36. # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  37. # Keep in mind you can assign values other than :controller and :action
  38.  
  39. # Sample of named route:
  40. # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
  41. # This route can be invoked with purchase_url(:id => product.id)
  42.  
  43. # Sample resource route (maps HTTP verbs to controller actions automatically):
  44. # map.resources :products
  45.  
  46. # Sample resource route with options:
  47. # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
  48.  
  49. # Sample resource route with sub-resources:
  50. # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
  51.  
  52. # Sample resource route with more complex sub-resources
  53. # map.resources :products do |products|
  54. # products.resources :comments
  55. # products.resources :sales, :collection => { :recent => :get }
  56. # end
  57.  
  58. # Sample resource route within a namespace:
  59. # map.namespace :admin do |admin|
  60. # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
  61. # admin.resources :products
  62. # end
  63.  
  64. # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
  65. map.root :controller => "mycontr", :action => "hellow"
  66.  
  67. # See how all your routes lay out with "rake routes"
  68.  
  69. # Install the default routes as the lowest priority.
  70. # Note: These default routes make all actions in every controller accessible via GET requests. You should
  71. # consider removing the them or commenting them out if you're using named routes and resources.
  72. map.connect ':controller/:action/:id'
  73. map.connect ':controller/:action/:id.:format'
  74. end
Add Comment
Please, Sign In to add comment