Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

On This Page:

  1. 1 Ruby link_button_to

Ruby link_button_to

A helper for a link_button_to.

def link_button_to(name, options = {}, html_options = {})        
    url = url_for(options)          
    html_options["onclick"] = "javascript:document.location.href='#{url}'; return false;"
    html_options.merge!("type" => "button", "value" => name)        
    tag("input", html_options)    
end


Usage: <%= link_button_to "Edit", url_for(:action=>"edit"), :class=>"my_custom_class" -%>
1 total

On This Page:

  1. 1 Ruby link_button_to