Run rack mini profiler in production

This commit is contained in:
Max Wofford 2025-04-03 20:57:48 -04:00
parent c3dac98855
commit 3f55de928f
2 changed files with 11 additions and 5 deletions

10
Gemfile
View file

@ -72,6 +72,11 @@ gem "http"
# Bulk import
gem "activerecord-import"
# Rack Mini Profiler [https://github.com/MiniProfiler/rack-mini-profiler]
gem "rack-mini-profiler"
# For memory profiling via RMP
gem "memory_profiler"
group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
@ -90,11 +95,6 @@ group :development do
# Preview emails in the browser [https://github.com/ryanb/letter_opener]
gem "letter_opener"
gem "letter_opener_web", "~> 3.0"
# Rack Mini Profiler [https://github.com/MiniProfiler/rack-mini-profiler]
gem "rack-mini-profiler"
# For memory profiling via RMP
gem "memory_profiler"
end
group :test do

View file

@ -2,6 +2,12 @@ class ApplicationController < ActionController::Base
before_action :set_paper_trail_whodunnit
before_action :initialize_cache_counters
before_action do
if current_user && current_user.is_admin?
Rack::MiniProfiler.authorize_request
end
end
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
# allow_browser versions: :modern