Sha256: 4469450403227fe0c16a8db2ff5d5b1cb721415b569123dbc0d8b9e79cc90403
Contents?: true
Size: 830 Bytes
Versions: 38
Compression:
Stored size: 830 Bytes
Contents
# frozen_string_literal: true module Decidim module Initiatives # Class uses to retrieve initiatives promoted by the given user class InitiativesPromoted < Rectify::Query attr_reader :user # Syntactic sugar to initialize the class and return the queried objects. # # user - Decidim::User def self.by(user) new(user).query end # Initializes the class. # # user: Decidim::User def initialize(user) @user = user end # Retrieves the initiatives promoted by the given user. def query Initiative .joins(:committee_members) .where("decidim_initiatives_committee_members.state = 2") .where("decidim_initiatives_committee_members.decidim_users_id = ?", user.id) end end end end
Version data entries
38 entries across 38 versions & 1 rubygems