Class: Decidim::Votings::Admin::AdminUsers

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

Overview

A class used to find the admins for a voting including organization admins.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voting) ⇒ AdminUsers

Initializes the class.

voting - a voting that needs to find its process admins


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

def initialize(voting)
  @voting = voting
end

Class Method Details

.for(voting) ⇒ Object

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

voting - a voting that needs to find its voting admins


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

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

Instance Method Details

#queryObject

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

Returns an ActiveRecord::Relation.


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

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