Class: JsonApiResource::Associations::Preloaders::HasManyPreloader

Inherits:
Base
  • Object
show all
Defined in:
lib/json_api_resource/associations/preloaders/has_many_preloader.rb

Instance Attribute Summary

Attributes inherited from Base

#association, #distributor

Instance Method Summary collapse

Methods inherited from Base

#initialize, #preload

Constructor Details

This class inherits a constructor from JsonApiResource::Associations::Preloaders::Base

Instance Method Details

#bulk_query(objects) ⇒ Object



6
7
8
9
# File 'lib/json_api_resource/associations/preloaders/has_many_preloader.rb', line 6

def bulk_query( objects )
  ids = objects.map(&:id)
  { key => ids }.merge(opts)
end

#distributor_classObject



15
16
17
# File 'lib/json_api_resource/associations/preloaders/has_many_preloader.rb', line 15

def distributor_class
  JsonApiResource::Associations::Preloaders::Distributors::DistributorByObjectId
end

#safe?(query) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/json_api_resource/associations/preloaders/has_many_preloader.rb', line 11

def safe?( query )
  query[key].present?
end