diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index efa3e7a14a..de964edae8 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -433,8 +433,9 @@ module ActionView def to_s #:nodoc: returning javascript = @lines * $/ do if ActionView::Base.debug_rjs - javascript.replace "try {\n#{javascript}\n} catch (e) " - javascript << "{ alert('RJS error:\\n\\n' + e.toString()); throw e }" + source = javascript.dup + javascript.replace "try {\n#{source}\n} catch (e) " + javascript << "{ alert('RJS error:\\n\\n' + e.toString()); alert('#{source.gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }}'); throw e }" end end end |