Skip to content

Commit

Permalink
Turn RJS debugging on by default and show the source code when an exc…
Browse files Browse the repository at this point in the history
…eption is caught [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 20, 2006
1 parent 1aff68d commit 4941475
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions actionpack/lib/action_view/helpers/prototype_helper.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions railties/environments/development.rb
Expand Up @@ -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.