Skip to main content

rack_mini_profiler_production

📊 Integrate rack-mini-profiler in Production-like Environments​

rack-mini-profiler provides deep insights into controller, view, and SQL timings. By enabling it in staging or production-perf mode, you can catch N+1 queries or slow view partials under realistic load.

# config/initializers/mini_profiler.rb
if Rails.env.staging? || Rails.env.production_perf?
require 'rack-mini-profiler'
Rack::MiniProfiler.config.position = 'right'
Rails.application.middleware.use(Rack::MiniProfiler)
end

Access the profiler badge in the browser to drill into individual SQL calls, view render times, and memory allocations.