public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
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
dhh (author)
Sun Mar 19 23:19:27 -0800 2006
commit  49414750693a61ad078549b9edb5260f32f69561
tree    0b5598daaaa51f6f0ef6cc623d7c824ec47258a4
parent  1aff68d61574410fa942aa34ec261c68565e48c1
...
433
434
435
436
437
 
 
 
438
439
440
...
433
434
435
 
 
436
437
438
439
440
441
0
@@ -433,8 +433,9 @@
0
           def to_s #:nodoc:
0
             returning javascript = @lines * $/ do
0
               if ActionView::Base.debug_rjs
0
- javascript.replace "try {\n#{javascript}\n} catch (e) "
0
- javascript << "{ alert('RJS error:\\n\\n' + e.toString()); throw e }"
0
+ source = javascript.dup
0
+ javascript.replace "try {\n#{source}\n} catch (e) "
0
+ javascript << "{ alert('RJS error:\\n\\n' + e.toString()); alert('#{source.gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }}'); throw e }"
0
               end
0
             end
0
           end
...
14
15
16
 
17
18
19
...
14
15
16
17
18
19
20
0
@@ -14,6 +14,7 @@
0
 # Show full error reports and disable caching
0
 config.action_controller.consider_all_requests_local = true
0
 config.action_controller.perform_caching = false
0
+config.action_view.debug_rjs = true
0
 
0
 # Don't care if the mailer can't send
0
 config.action_mailer.raise_delivery_errors = false

Comments

    No one has commented yet.