Sha256: 9932a303474c57241ad0b785670f42552701622305273b97f4cc8c6caa083691

Contents?: true

Size: 655 Bytes

Versions: 25

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 < Decidim::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

25 entries across 25 versions & 1 rubygems

Version Path
decidim-initiatives-0.29.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.4 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.9 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.29.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.3 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.8 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.29.0.rc4 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.29.0.rc3 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.29.0.rc2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.29.0.rc1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.2 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.7 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.1 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.6 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.0 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.5 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.0.rc5 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.28.0.rc4 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.4 app/queries/decidim/initiatives/initiatives_created.rb
decidim-initiatives-0.27.3 app/queries/decidim/initiatives/initiatives_created.rb