Link to an Action : Action « Rails « Ruby






Link to an Action


class HelloController < ApplicationController
  def there

  end
  
  def here

  end
  
end


// File: app\views\hello\there.rhtml:
 <html>
   <head>
     <title>Using Two Views</title>
   </head>
   <body>
     <br>
     <%= link_to "Go to here.", :action => "here" %>
     <br>
     <br>
     This is an active view in a Ruby on Rails application.
   </body>
 </html>


 Start the WEBrick server: ruby script/server
 Navigate to http://localhost:3000/hello/there;



 








linkToAction.zip( 88 k)

Related examples in the same category

1.Passing Data from an Action to a View
2.Create an Application with Two Actions
3.Display random image