Skip to content

Commit

Permalink
Keep the extension work in one common place
Browse files Browse the repository at this point in the history
This is the very first Railtie initializer.
  • Loading branch information
gsamokovarov committed Mar 29, 2017
1 parent 3a6864a commit bf82820
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 3 additions & 1 deletion lib/web_console/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def console(binding = Bindex.current_bindings.second)
end

module WebConsole
module DebugExceptions
module DebugExceptionsExt
def render_exception(request, exception)
super(request, exception).tap do
backtrace_cleaner = request.get_header('action_dispatch.backtrace_cleaner')
Expand All @@ -40,3 +40,5 @@ def render_exception(request, exception)
end
end
end

ActionDispatch::DebugExceptions.prepend(WebConsole::DebugExceptionsExt)
7 changes: 1 addition & 6 deletions lib/web_console/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Railtie < ::Rails::Railtie
if mount_point = config.web_console.mount_point
Middleware.mount_point = mount_point.chomp('/')
end

if root = Rails.application.config.relative_url_root
Middleware.mount_point = File.join(root, Middleware.mount_point)
end
Expand All @@ -66,11 +67,5 @@ class Railtie < ::Rails::Railtie
initializer 'i18n.load_path' do
config.i18n.load_path.concat(Dir[File.expand_path('../locales/*.yml', __FILE__)])
end

initializer 'web_console.patch_debug_exception_middleware' do |app|
app.config.after_initialize do
ActionDispatch::DebugExceptions.prepend DebugExceptions
end
end
end
end

0 comments on commit bf82820

Please sign in to comment.