aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 033aff5044..7dccecda13 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -48,9 +48,13 @@ module ActionView
# link_to_function "Greeting", "alert('Hello world!')"
# link_to_function(image_tag("delete"), "if confirm('Really?'){ do_delete(); }")
def link_to_function(name, function, html_options = {})
+ html_options.symbolize_keys!
content_tag(
"a", name,
- {:href => "#", :onclick => "#{function}; return false;"}.merge(html_options.symbolize_keys)
+ html_options.merge({
+ :href => html_options[:href] || "#",
+ :onclick => "#{function};#{html_options[:onclick] ? " #{html_options[:onclick]};" : ""} return false;"
+ })
)
end