Class: Ekylibre::PluginSystem::Middleware::RackMiddleware
- Inherits:
-
Object
- Object
- Ekylibre::PluginSystem::Middleware::RackMiddleware
- Defined in:
- lib/ekylibre/plugin_system/middleware/rack_middleware.rb
Overview
Rack middleware adding the provided container to the request context
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, container) ⇒ RackMiddleware
constructor
A new instance of RackMiddleware.
Constructor Details
#initialize(app, container) ⇒ RackMiddleware
Returns a new instance of RackMiddleware.
10 11 12 13 |
# File 'lib/ekylibre/plugin_system/middleware/rack_middleware.rb', line 10 def initialize(app, container) @app = app @container = container end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ekylibre/plugin_system/middleware/rack_middleware.rb', line 15 def call(env) # request_container = enter_tenant(container, ::Ekylibre::Tenant.current) GlobalContainer.replace_with(container) do # We HAVE to mutate the environment because Devise (and maybe other) needs to pass information up the middleware stack # from the Rails application to the Auth middleware through the environment env['container'] = container @app.call(env) end end |