Update api_controller.rb
Add N+1 detectioin via Prosopite in development/test environments
This commit is contained in:
parent
0ad2db92fa
commit
e7db082d8b
1 changed files with 14 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue