Class: Decidim::Initiatives::Admin::AdminUsers

Inherits:
Rectify::Query
  • Object
show all
Defined in:
decidim-initiatives/app/queries/decidim/initiatives/admin/admin_users.rb

Overview

A class used to find the admins for an initiative.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initiative) ⇒ AdminUsers

Initializes the class.

initiative - Decidim::Initiative


18
19
20
# File 'decidim-initiatives/app/queries/decidim/initiatives/admin/admin_users.rb', line 18

def initialize(initiative)
  @initiative = initiative
end

Class Method Details

.for(initiative) ⇒ Object

Syntactic sugar to initialize the class and return the queried objects.

initiative - Decidim::Initiative


11
12
13
# File 'decidim-initiatives/app/queries/decidim/initiatives/admin/admin_users.rb', line 11

def self.for(initiative)
  new(initiative).query
end

Instance Method Details

#queryObject

Finds organization admins and the users with role admin for the given initiative.

Returns an ActiveRecord::Relation.


25
26
27
# File 'decidim-initiatives/app/queries/decidim/initiatives/admin/admin_users.rb', line 25

def query
  Decidim::User.where(id: organization_admins)
end