Sha256: a737ecfebb78ed601b68371cab42fe3c083653cab7600245be81bbb1f584d820

Contents?: true

Size: 751 Bytes

Versions: 149

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module ModalityScopes
    def with_current_modality_matching(modality_names)
      joins(:modality_descriptions)
        .where(
          modality_descriptions: {
            name: Array(modality_names)
          },
          modality_modalities: {
            state: "current",
            ended_on: nil
          })
      .includes(:modality_description)
    end

    def with_current_modality_of_class(klass)
      joins(:modality_descriptions)
        .where(
          modality_descriptions: {
            type: klass.name
          },
          modality_modalities: {
            state: "current",
            ended_on: nil
          })
      .includes(:modality_description)
    end
  end
end

Version data entries

149 entries across 149 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.1.0 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.167 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.166 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.165 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.164 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.163 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.162 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.161 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.160 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.159 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.158 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.157 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.156 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.155 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.153 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.152 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.151 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.149 app/models/concerns/renalware/modality_scopes.rb
renalware-core-2.0.148 app/models/concerns/renalware/modality_scopes.rb