Class: Decidim::Admin::Invites
- Inherits:
-
Query
- Object
- Query
- Decidim::Admin::Invites
- Defined in:
- app/queries/decidim/admin/invites.rb
Overview
A class used to find the Invites by their status status.
Class Method Summary collapse
-
.for(invites, query = nil, status = nil) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
Instance Method Summary collapse
-
#initialize(invites, query = nil, status = nil) ⇒ Invites
constructor
Initializes the class.
-
#query ⇒ Object
List the invites by the different filters.
Constructor Details
#initialize(invites, query = nil, status = nil) ⇒ Invites
Initializes the class.
invites - the initial Invites relation that need to be filtered query - query to filter invites status - invite status to be used as a filter
21 22 23 24 25 |
# File 'app/queries/decidim/admin/invites.rb', line 21 def initialize(invites, query = nil, status = nil) @invites = invites @query = query @status = status end |
Class Method Details
.for(invites, query = nil, status = nil) ⇒ Object
Syntactic sugar to initialize the class and return the queried objects.
invites - the initial Invites relation that needs to be filtered. query - query to filter invites status - invite status to be used as a filter
12 13 14 |
# File 'app/queries/decidim/admin/invites.rb', line 12 def self.for(invites, query = nil, status = nil) new(invites, query, status).query end |
Instance Method Details
#query ⇒ Object
List the invites by the different filters.
28 29 30 31 32 |
# File 'app/queries/decidim/admin/invites.rb', line 28 def query @invites = filter_by_search(@invites) @invites = filter_by_status(@invites) @invites end |