diff options
author | Vipul A M <vipulnsward@gmail.com> | 2016-05-31 09:46:25 -0700 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2016-07-01 15:47:06 -0700 |
commit | 1eb358299ccd70732016cdef21068031f27f7ffa (patch) | |
tree | 7a057eccf9d1a1f38610a310742ed78d1d4ad161 | |
parent | 173bf3506d99c0767a41d30fbe4d306201369194 (diff) | |
download | rails-1eb358299ccd70732016cdef21068031f27f7ffa.tar.gz rails-1eb358299ccd70732016cdef21068031f27f7ffa.tar.bz2 rails-1eb358299ccd70732016cdef21068031f27f7ffa.zip |
Fixes #25219
Add handling of cleaning up backtrace from IRB console in case of errors
-rw-r--r-- | railties/lib/rails/backtrace_cleaner.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/console.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/railties/lib/rails/backtrace_cleaner.rb b/railties/lib/rails/backtrace_cleaner.rb index 5276eb33c9..7b7036041e 100644 --- a/railties/lib/rails/backtrace_cleaner.rb +++ b/railties/lib/rails/backtrace_cleaner.rb @@ -2,7 +2,7 @@ require 'active_support/backtrace_cleaner' module Rails class BacktraceCleaner < ActiveSupport::BacktraceCleaner - APP_DIRS_PATTERN = /^\/?(app|config|lib|test)/ + APP_DIRS_PATTERN = /^\/?(app|config|lib|test|\(\w*\))/ RENDER_TEMPLATE_PATTERN = /:in `_render_template_\w*'/ EMPTY_STRING = ''.freeze SLASH = '/'.freeze diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index ea5d20ea24..a4ab31f793 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -7,6 +7,14 @@ module Rails class Console include ConsoleHelper + module BacktraceCleaner + def filter_backtrace(bt) + if result = super + Rails.backtrace_cleaner.filter([result]).first + end + end + end + class << self def parse_arguments(arguments) options = {} @@ -34,6 +42,10 @@ module Rails app.load_console @console = app.config.console || IRB + + if @console == IRB + IRB::WorkSpace.prepend(BacktraceCleaner) + end end def sandbox? |