diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers/scriptaculous_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/scriptaculous_helper.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb index 189c14c97a..37319cca1b 100644 --- a/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +++ b/actionpack/lib/action_view/helpers/scriptaculous_helper.rb @@ -216,6 +216,15 @@ module ActionView %(Droppables.add(#{ActiveSupport::JSON.encode(element_id)}, #{options_for_javascript(options)});) end + + protected + def array_or_string_for_javascript(option) + if option.kind_of?(Array) + "['#{option.join('\',\'')}']" + elsif !option.nil? + "'#{option}'" + end + end end module PrototypeHelper |