Module | Sequel::Plugins::TacticalEagerLoading
In: | lib/sequel/plugins/tactical_eager_loading.rb

The tactical_eager_loading plugin allows you to eagerly load an association for all objects retrieved from the same dataset without calling eager on the dataset. If you attempt to load associated objects for a record and the association for that object is currently not cached, it assumes you want to get the associated objects for all objects retrieved with the dataset that retrieved the current object.

Tactical eager loading only takes affect if you retrieved the current object with Dataset#all, it doesn‘t work if you retrieved the current object with Dataset#each.

Basically, this allows the following code to issue only two queries:

      Album.filter{id<100}.all do |a|
        a.artists
      end

Usage:

      # Make all model subclass instances use tactical eager loading (called before loading subclasses)
      Sequel::Model.plugin :tactical_eager_loading

      # Make the Album class use tactical eager loading
      Album.plugin :tactical_eager_loading

### Classes and Modules

Module Sequel::Plugins::TacticalEagerLoading::DatasetMethods
Module Sequel::Plugins::TacticalEagerLoading::InstanceMethods

[Validate]