Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini profiler not running on start #27

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/mini_profiler/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def self.attributes
attr_accessor :auto_inject, :base_url_path, :pre_authorize_cb, :position,
:backtrace_remove, :backtrace_includes, :backtrace_ignores, :skip_schema_queries,
:storage, :user_provider, :storage_instance, :storage_options, :skip_paths, :authorization_mode,
:toggle_shortcut, :start_hidden, :backtrace_threshold_ms, :storage_failure, :logger,
:insert_after_middlewares
:toggle_shortcut, :start_hidden, :backtrace_threshold_ms, :storage_failure, :logger

# Deprecated options
attr_accessor :use_existing_jquery
Expand All @@ -38,7 +37,6 @@ def self.default
@toggle_shortcut = 'Alt+P'
@start_hidden = false
@backtrace_threshold_ms = 0
@insert_after_middlewares = %w{HerokuDeflater::SkipBinary Rack::Deflater}
@storage_failure = Proc.new do |exception|
if @logger
@logger.warn("MiniProfiler storage failure: #{exception.message}")
Expand Down
13 changes: 1 addition & 12 deletions lib/mini_profiler_rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,7 @@ class Railtie < ::Rails::Railtie

initializer "rack_mini_profiler.configure_rails_initialization" do |app|
Rack::MiniProfilerRails.initialize!(app)
end

config.after_initialize do |app|
# Install the Middleware - wait until all middlewares have been added
insert_position = 0
insert_after_middlewares = Array(Rack::MiniProfiler.config.insert_after_middlewares)

app.config.middleware.each_with_index do |middleware, index|
insert_position = (index + 1) if insert_after_middlewares.include?(middleware.klass.name)
end

app.middleware.insert(insert_position, Rack::MiniProfiler)
app.middleware.use(Rack::MiniProfiler)
end

# TODO: Implement something better here
Expand Down