Passing Data from an Action to a View : Action « Rails « Ruby






Passing Data from an Action to a View



//Controller:

class HelloController < ApplicationController
  def there
    @time_now = Time.now
  end
end


//View:


 <html>
   <head>
     <title>Using Views</title>
   </head>
   <body>
     The time is now <%= @time_now %>
   </body>
 </html>
 
 

 








passValueFromControllerToView.zip( 91 k)

Related examples in the same category

1.Create an Application with Two Actions
2.Link to an Action
3.Display random image