Class: Decidim::Assemblies::FilteredAssemblies
- Inherits:
-
Query
- Object
- Query
- Decidim::Assemblies::FilteredAssemblies
- Defined in:
- app/queries/decidim/assemblies/filtered_assemblies.rb
Overview
This query filters assemblies by type.
Instance Method Summary collapse
- #assemblies ⇒ Object
-
#initialize(filter) ⇒ FilteredAssemblies
constructor
A new instance of FilteredAssemblies.
- #query ⇒ Object
Constructor Details
#initialize(filter) ⇒ FilteredAssemblies
Returns a new instance of FilteredAssemblies.
7 8 9 |
# File 'app/queries/decidim/assemblies/filtered_assemblies.rb', line 7 def initialize(filter) @filter = filter end |
Instance Method Details
#assemblies ⇒ Object
11 12 13 |
# File 'app/queries/decidim/assemblies/filtered_assemblies.rb', line 11 def assemblies Decidim::Assembly end |
#query ⇒ Object
15 16 17 18 19 |
# File 'app/queries/decidim/assemblies/filtered_assemblies.rb', line 15 def query return assemblies.all if @filter.blank? assemblies.where(decidim_assemblies_type_id: @filter) end |