1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Add handling of cleaning up backtrace from IRB console in case of errors
This commit is contained in:
Vipul A M 2016-05-31 09:46:25 -07:00
parent 173bf3506d
commit 1eb358299c
No known key found for this signature in database
GPG key ID: 4C9362FE1F574587
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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?