Class: ActiveRecord::Associations::Preloader::ManualPreloader

Inherits:
ActiveRecord::Associations::Preloader
  • Object
show all
Defined in:
lib/autoload/active_record/associations/preloader/manual_preloader.rb

Overview

Instance Method Summary collapse

Instance Method Details

#preload(owners, associations, children) ⇒ Object

Preloads the given owners by specifying the children for the given association.


7
8
9
# File 'lib/autoload/active_record/associations/preloader/manual_preloader.rb', line 7

def preload(owners, associations, children)
  super
end

#preloader_for(reflection, owners, rhs_klass) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/autoload/active_record/associations/preloader/manual_preloader.rb', line 11

def preloader_for(reflection, owners, rhs_klass)
  preloader_class = super
  case preloader_class.name
  when HasMany.name
    ActiveRecord::Associations::Preloader::ManualHasMany
  when NullPreloader.name, AlreadyLoaded.name
    preloader_class
  else
    raise NotImplementedError
  end
end