Sha256: af44bec8185007eda1ce3a65aac9d6773b3df2aa0febf3088aa08280777f3da7

Contents?: true

Size: 655 Bytes

Versions: 63

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Class uses to retrieve the initiatives created by the given user.
    class InitiativesCreated < 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 created by the given user
      def query
        Initiative.where(author: user)
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
decidim-initiatives-0.17.2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.18.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.17.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.16.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.17.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.16.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.15.2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.15.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.15.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.14.4 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.14.3 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.14.2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.14.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.13.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.12.2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.13.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.12.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.13.0.pre1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.12.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.11.2 app/queries/decidim/initiatives/initiatives_created.rb