aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb8
1 files 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