Class: AndOne::DevUI
- Inherits:
-
Object
- Object
- AndOne::DevUI
- Defined in:
- lib/and_one/dev_ui.rb
Overview
A tiny Rack endpoint that shows all N+1s detected in the current server
session. Mount at /__and_one in development to get a mini dashboard
for N+1 queries with fix suggestions.
Usage (manual):
app.middleware.use AndOne::DevUI
Or it's auto-mounted by the Railtie in development.
Constant Summary collapse
- MOUNT_PATH =
"/__and_one"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ DevUI
constructor
A new instance of DevUI.
Constructor Details
#initialize(app) ⇒ DevUI
Returns a new instance of DevUI.
15 16 17 |
# File 'lib/and_one/dev_ui.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/and_one/dev_ui.rb', line 19 def call(env) if env["PATH_INFO"] == MOUNT_PATH serve_dashboard(env) else @app.call(env) end end |