Update api_controller.rb

Add N+1 detectioin via Prosopite in development/test environments
This commit is contained in:
Justin Edmund 2025-02-07 01:50:58 -08:00
parent 0ad2db92fa
commit e7db082d8b

View file

@ -28,6 +28,17 @@ module Api
render_error(e) render_error(e)
end end
unless Rails.env.production?
around_action :n_plus_one_detection
def n_plus_one_detection
Prosopite.scan
yield
ensure
Prosopite.finish
end
end
##### Hooks ##### Hooks
before_action :current_user before_action :current_user
before_action :default_content_type before_action :default_content_type