Class: Decidim::Initiatives::InitiativeTypes

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

Overview

Class uses to retrieve the available initiative types.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization) ⇒ InitiativeTypes

Initializes the class.

organization - Decidim::Organization


17
18
19
# File 'decidim-initiatives/app/queries/decidim/initiatives/initiative_types.rb', line 17

def initialize(organization)
  @organization = organization
end

Class Method Details

.for(organization) ⇒ Object

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

organization - Decidim::Organization


10
11
12
# File 'decidim-initiatives/app/queries/decidim/initiatives/initiative_types.rb', line 10

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

Instance Method Details

#queryObject

Retrieves the available initiative types for the given organization.


22
23
24
# File 'decidim-initiatives/app/queries/decidim/initiatives/initiative_types.rb', line 22

def query
  InitiativesType.where(organization: @organization)
end