Module: Api::RequestIO::Extensions

Included in:
Request
Defined in:
app/models/api/request_io.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/api/request_io.rb', line 11

def self.included(base)
  base.class_eval do
    extend ClassMethods

    scope :including_associations_for_json, -> {
      includes([
        :uuid_object,
        :request_type,
        :request_metadata,
        :user, {
          asset: [
            :uuid_object,
            :barcodes,
            { primary_aliquot: { sample: :uuid_object } }
          ],
          target_asset: [
            :uuid_object,
            :barcodes,
            { primary_aliquot: { sample: :uuid_object } }
          ],
          initial_study: :uuid_object,
          initial_project: :uuid_object
        }
      ])
    }
  end
end

Instance Method Details

#json_rootObject


39
40
41
# File 'app/models/api/request_io.rb', line 39

def json_root
  'request' # frozen for subclass of the API
end