aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-25 09:44:43 +0100
committerXavier Noria <fxn@hashref.com>2011-04-13 13:23:16 +0200
commit25181cafee9ef087a14b5134b9fa1f85f758705a (patch)
tree276610c4a7c6e3d29bfe2addcceb7e7adf4d11c0 /actionpack
parentf9472f064fae12d0890075d698d8e5fd81289392 (diff)
downloadrails-25181cafee9ef087a14b5134b9fa1f85f758705a.tar.gz
rails-25181cafee9ef087a14b5134b9fa1f85f758705a.tar.bz2
rails-25181cafee9ef087a14b5134b9fa1f85f758705a.zip
let the default function in button_to_function be nil
I don't know which is the use case for button_to_function(name) but there's a test for it. I am focused now on RJS extraction and do not want to introduce a backwards incompatible change at this moment. Perhaps worth revisiting when the whole thing is done.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 5a1d07fd24..066f0ab409 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -105,7 +105,7 @@ module ActionView
# button_to_function "Greeting", "alert('Hello world!')", :class => "ok"
# # => <input class="ok" onclick="alert('Hello world!');" type="button" value="Greeting" />
#
- def button_to_function(name, function='', html_options={})
+ def button_to_function(name, function=nil, html_options={})
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function};"
tag(:input, html_options.merge(:type => 'button', :value => name, :onclick => onclick))