Sha256: e0dba7199aae670a3a7fe7966ba0608c4796b865d323f275389636e5a773a840
Contents?: true
Size: 894 Bytes
Versions: 27
Compression:
Stored size: 894 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters module QueryableLetter extend ActiveSupport::Concern included do self.ransacker :effective_date, type: :date do Arel.sql(Letter.effective_date_sort) end def self.state_eq(state = :draft) where(type: Letter.state_class_name(state)) end def self.finder_needs_type_condition? false end def self.ransackable_scopes(_auth_object = nil) %i(state_eq) end end end class LetterQuery def initialize(q: nil) @q = q || {} @q[:s] ||= ["effective_date desc"] end def call search.result end def search @search ||= Letter.include(QueryableLetter).includes(:event).search(@q) end end end end
Version data entries
27 entries across 27 versions & 1 rubygems