Sha256: 00032390cd476e0b0bdc7918cf7471cd5ab6fa5297b26e5358971a7098285278

Contents?: true

Size: 645 Bytes

Versions: 27

Compression:

Stored size: 645 Bytes

Contents

require_dependency "renalware/letters"

module Renalware
  module Letters
    module QueryableLetter
      def finder_needs_type_condition?
        false
      end

      def ransackable_scopes(_auth_object = nil)
        %i(state_eq)
      end

      def state_eq(state = :draft)
        where(type: Letter.state_class_name(state))
      end
    end

    class LetterQuery
      def initialize(q: nil)
        @q = q || {}
        @q[:s] ||= ["issued_on desc"]
      end

      def call
        search.result
      end

      def search
        @search ||= Letter.extend(QueryableLetter).includes(:event).search(@q)
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.7 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.5 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.4 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.3 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.2 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.1 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/letters/letter_query.rb