class JsonApiResource::Associations::Preloaders::Base
Attributes
association[RW]
distributor[RW]
Public Class Methods
new(association)
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 10 def initialize(association) self.association = association self.distributor = distributor_class.new association end
Public Instance Methods
preload( objects )
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 15 def preload( objects ) query = bulk_query( objects ) if safe? query results = klass.send action, query else results = [] end distributor.distribute objects, results end
Private Instance Methods
assign( objects, results )
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 32 def assign( objects, results ) raise NotImplementedError end
bulk_query( objects )
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 36 def bulk_query( objects ) raise NotImplementedError end
distributor_class()
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 40 def distributor_class raise NotImplementedError end
safe?( query )
click to toggle source
# File lib/json_api_resource/associations/preloaders/base.rb, line 28 def safe?( query ) raise NotImplementedError end