aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/prototype_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-20 07:19:27 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-20 07:19:27 +0000
commit49414750693a61ad078549b9edb5260f32f69561 (patch)
tree0b5598daaaa51f6f0ef6cc623d7c824ec47258a4 /actionpack/lib/action_view/helpers/prototype_helper.rb
parent1aff68d61574410fa942aa34ec261c68565e48c1 (diff)
downloadrails-49414750693a61ad078549b9edb5260f32f69561.tar.gz
rails-49414750693a61ad078549b9edb5260f32f69561.tar.bz2
rails-49414750693a61ad078549b9edb5260f32f69561.zip
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
Diffstat (limited to 'actionpack/lib/action_view/helpers/prototype_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb5
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