Permalink
Browse files

Turn RJS debugging on by default and show the source code when an exc…

…eption is caught [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1aff68d commit 49414750693a61ad078549b9edb5260f32f69561 @dhh dhh committed Mar 20, 2006
Showing with 4 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_view/helpers/prototype_helper.rb
  2. +1 −0 railties/environments/development.rb
@@ -433,8 +433,9 @@ module GeneratorMethods
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
@@ -14,6 +14,7 @@
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
+config.action_view.debug_rjs = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

0 comments on commit 4941475

Please sign in to comment.