Class: Decidim::TermCustomizer::OrganizationTranslationSets
- Inherits:
-
Rectify::Query
- Object
- Rectify::Query
- Decidim::TermCustomizer::OrganizationTranslationSets
- Defined in:
- app/queries/decidim/term_customizer/organization_translation_sets.rb
Overview
This query class filters all assemblies given an organization.
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(organization) ⇒ OrganizationTranslationSets
constructor
A new instance of OrganizationTranslationSets.
- #query ⇒ Object
Constructor Details
#initialize(organization) ⇒ OrganizationTranslationSets
Returns a new instance of OrganizationTranslationSets.
7 8 9 |
# File 'app/queries/decidim/term_customizer/organization_translation_sets.rb', line 7 def initialize(organization) @organization = organization end |
Instance Method Details
#count ⇒ Object
26 27 28 |
# File 'app/queries/decidim/term_customizer/organization_translation_sets.rb', line 26 def count query.count(:id) end |
#query ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/queries/decidim/term_customizer/organization_translation_sets.rb', line 11 def query columns = [ "DISTINCT(decidim_term_customizer_translation_sets.id)", "name", "name->>'#{current_locale}' AS local_name" ] q = Decidim::TermCustomizer::TranslationSet.joins(:constraints).where( decidim_term_customizer_constraints: { decidim_organization_id: @organization.id } ).select(columns.join(",")) q.order("local_name") end |