aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb5
-rw-r--r--railties/environments/development.rb1
2 files changed, 4 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
diff --git a/railties/environments/development.rb b/railties/environments/development.rb
index dbf77d03b7..cbd8529e6c 100644
--- a/railties/environments/development.rb
+++ b/railties/environments/development.rb
@@ -14,6 +14,7 @@ config.breakpoint_server = true
# 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