From 49414750693a61ad078549b9edb5260f32f69561 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 20 Mar 2006 07:19:27 +0000 Subject: Turn RJS debugging on by default and show the source code when an exception is caught [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/prototype_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/prototype_helper.rb') 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 -- cgit v1.2.3