From 0cb18335d9108c0c2d7796257446ad3741661939 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 21 Mar 2005 23:41:25 +0000 Subject: [PATCH] fix for javascript_helper.rb build_callbacks #893 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@970 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/javascript_helper.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 569f3ff194..3de110428f 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -169,9 +169,11 @@ module ActionView def build_callbacks(options) CALLBACKS.inject({}) do |callbacks, callback| - name = 'on' + callback.to_s.capitalize - code = escape_javascript(options[callback]) - callbacks[name] = "function(request){#{code}}" if callbacks[name] + if options[callback] + name = 'on' + callback.to_s.capitalize + code = escape_javascript(options[callback]) + callbacks[name] = "function(request){#{code}}" + end callbacks end end