Module: ModelExtensions::Request

Included in:
Request
Defined in:
app/api/model_extensions/request.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/api/model_extensions/request.rb', line 2

def self.included(base)
  base.class_eval do
    scope :include_source_asset, -> {
      includes(
        asset: [
          :uuid_object,
          :barcodes,
          :scanned_into_lab_event,
          { aliquots: [:sample, :tag] }
        ]
      )
    }
    scope :include_target_asset, -> {
      includes(
        target_asset: [
          :uuid_object,
          :barcodes,
          { aliquots: [:sample, :tag] }
        ]
      )
    }

    scope :include_study, -> { includes(study: :uuid_object) }
    scope :include_project, -> { includes(project: :uuid_object) }
    scope :include_request_type, -> { includes(:request_type) }
    scope :include_submission, -> { includes(submission: :uuid_object) }
  end
end