link_to syntax

<%= link_to display_text, link, { option } %>

The three options specific to link_to (:confirm, :popup, and :method)
link_to "Visit Other Site", "http://www.rubyonrails.org/", :confirm => "Are you sure?"
# => Visit Other Site

link_to "Help", { :action => "help" }, :popup => true
# => Help

link_to "View Image", @image, :popup => ['new_window_name', 'height=300,width=600']
# => View Image

link_to "Delete Image", @image, :confirm => "Are you sure?", :method => :delete
# => Delete Image

Others:
  • link_to_if
  • link_to_unless
  • link_to_unless_current
  • mail_to
  • url_for


http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001565

1 comments:

Admiral Adney said...

I was searching for ruby on rails development and landed up on your post and i must say thanks for sharing such useful information.

Post a Comment