Module: ArLazyPreload

Defined in:
lib/ar_lazy_preload.rb,
lib/ar_lazy_preload/context.rb,
lib/ar_lazy_preload/railtie.rb,
lib/ar_lazy_preload/version.rb,
lib/ar_lazy_preload/preloader.rb,
lib/ar_lazy_preload/configuration.rb,
lib/ar_lazy_preload/active_record/base.rb,
lib/ar_lazy_preload/active_record/merger.rb,
lib/ar_lazy_preload/contexts/base_context.rb,
lib/ar_lazy_preload/active_record/relation.rb,
lib/ar_lazy_preload/association_tree_builder.rb,
lib/ar_lazy_preload/active_record/association.rb,
lib/ar_lazy_preload/associated_context_builder.rb,
lib/ar_lazy_preload/preloaded_records_converter.rb,
lib/ar_lazy_preload/contexts/auto_preload_context.rb,
lib/ar_lazy_preload/contexts/lazy_preload_context.rb,
lib/ar_lazy_preload/active_record/collection_proxy.rb,
lib/ar_lazy_preload/contexts/temporary_preload_config.rb,
lib/ar_lazy_preload/active_record/association_relation.rb,
lib/ar_lazy_preload/active_record/collection_association.rb

Defined Under Namespace

Modules: Association, AssociationRelation, Base, CollectionAssociation, CollectionProxy, Contexts, Merger, Relation Classes: AssociatedContextBuilder, AssociationTreeBuilder, Configuration, Context, PreloadedRecordsConverter, Preloader, Railtie

Constant Summary collapse

VERSION =
"2.1.0"

Class Method Summary collapse

Class Method Details

.configObject



16
17
18
# File 'lib/ar_lazy_preload.rb', line 16

def config
  @config ||= Configuration.new
end

.install_hooksObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ar_lazy_preload.rb', line 20

def install_hooks
  ActiveRecord::Base.include(Base)

  ActiveRecord::Relation.prepend(Relation)
  ActiveRecord::AssociationRelation.prepend(AssociationRelation)
  ActiveRecord::Relation::Merger.prepend(Merger)

  ActiveRecord::Associations::CollectionAssociation.prepend(Association)
  ActiveRecord::Associations::Association.prepend(Association)

  ActiveRecord::Associations::CollectionAssociation.prepend(CollectionAssociation)
  ActiveRecord::Associations::CollectionProxy.prepend(CollectionProxy)

  ArLazyPreload::Preloader.patch_for_rails_7! if ActiveRecord::VERSION::MAJOR >= 7
end