class Ekylibre::PluginSystem::Middleware::RackMiddleware

Rack middleware adding the provided container to the request context

Attributes

container[R]

@return [Corindon::DependencyInjection::Container]

Public Class Methods

new(app, container) click to toggle source

@param [#call] app @param [Corindon::DependencyInjection::Container] container

# File lib/ekylibre/plugin_system/middleware/rack_middleware.rb, line 10
def initialize(app, container)
  @app = app
  @container = container
end

Public Instance Methods

call(env) click to toggle source
# 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