diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-20 07:19:27 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-20 07:19:27 +0000 |
commit | 49414750693a61ad078549b9edb5260f32f69561 (patch) | |
tree | 0b5598daaaa51f6f0ef6cc623d7c824ec47258a4 /actionpack/lib/action_view/helpers | |
parent | 1aff68d61574410fa942aa34ec261c68565e48c1 (diff) | |
download | rails-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')
-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 |