Class: Decidim::Conferences::Admin::AdminUsers
- Inherits:
-
Query
- Object
- Query
- Decidim::Conferences::Admin::AdminUsers
- Defined in:
- app/queries/decidim/conferences/admin/admin_users.rb
Overview
A class used to find the admins for a conference or an organization conferences.
Class Method Summary collapse
-
.for(conference) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
-
.for_organization(organization) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(conference, organization = nil) ⇒ AdminUsers
constructor
Initializes the class.
-
#query ⇒ Object
Finds organization admins and the users with role admin for the given conference.
Constructor Details
#initialize(conference, organization = nil) ⇒ AdminUsers
Initializes the class.
conference - a conference that needs to find its conference admins organization - an organization that needs to find its conference admins
26 27 28 29 |
# File 'app/queries/decidim/conferences/admin/admin_users.rb', line 26 def initialize(conference, organization = nil) @conference = conference @organization = conference&.organization || organization end |
Class Method Details
.for(conference) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
conference - a conference that needs to find its conference admins
11 12 13 |
# File 'app/queries/decidim/conferences/admin/admin_users.rb', line 11 def self.for(conference) new(conference).query end |
.for_organization(organization) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
organization - an organization that needs to find its conference admins
18 19 20 |
# File 'app/queries/decidim/conferences/admin/admin_users.rb', line 18 def self.for_organization(organization) new(nil, organization).query end |
Instance Method Details
#query ⇒ Object
Finds organization admins and the users with role admin for the given conference.
Returns an ActiveRecord::Relation.
34 35 36 |
# File 'app/queries/decidim/conferences/admin/admin_users.rb', line 34 def query organization.admins.or(conferences_user_admins) end |