Class: Decidim::CurrentOrganization

Inherits:
Object
  • Object
show all
Defined in:
app/middleware/decidim/current_organization.rb

Overview

A middleware that enhances the request with the current organization based on the hostname.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CurrentOrganization

Initializes the Rack Middleware.

app - The Rack application



9
10
11
# File 'app/middleware/decidim/current_organization.rb', line 9

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Main entry point for a Rack Middleware.

env - A Hash.



16
17
18
19
# File 'app/middleware/decidim/current_organization.rb', line 16

def call(env)
  env["decidim.current_organization"] = detect_current_organization(env)
  @app.call(env)
end