Module: Decidim::NeedsOrganization

Included in:
ApplicationController
Defined in:
app/controllers/concerns/decidim/needs_organization.rb

Overview

Shared behaviour for controllers that need an organization present in order to work. The organization is injected via the CurrentOrganization middleware.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.enhance_controller(instance_or_module) ⇒ Object



8
9
10
11
12
13
# File 'app/controllers/concerns/decidim/needs_organization.rb', line 8

def self.enhance_controller(instance_or_module)
  instance_or_module.class_eval do
    before_action :verify_organization
    helper_method :current_organization
  end
end

.extended(base) ⇒ Object



15
16
17
18
19
# File 'app/controllers/concerns/decidim/needs_organization.rb', line 15

def self.extended(base)
  base.extend InstanceMethods

  enhance_controller(base)
end

.included(base) ⇒ Object



21
22
23
24
25
# File 'app/controllers/concerns/decidim/needs_organization.rb', line 21

def self.included(base)
  base.include InstanceMethods

  enhance_controller(base)
end