mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixes #25219
Add handling of cleaning up backtrace from IRB console in case of errors
This commit is contained in:
parent
173bf3506d
commit
1eb358299c
2 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue