module Sequel::Plugins::ForbidLazyLoad::ClassMethods

Public Instance Methods

allow_lazy_load_for_static_cache_associations() click to toggle source

If the static_cache plugin is used by the associated class for an association, allow lazy loading that association, since the lazy association load will use a hash table lookup and not a query.

    # File lib/sequel/plugins/forbid_lazy_load.rb
113 def allow_lazy_load_for_static_cache_associations
114   if defined?(::Sequel::Plugins::StaticCache::ClassMethods)
115     @association_reflections.each_value do |ref|
116       if ref.associated_class.is_a?(::Sequel::Plugins::StaticCache::ClassMethods)
117         ref[:forbid_lazy_load] = false
118       end
119     end
120   end
121 end
finalize_associations() click to toggle source

Allow lazy loading for static cache associations before finalizing.

Calls superclass method
    # File lib/sequel/plugins/forbid_lazy_load.rb
124 def finalize_associations
125   allow_lazy_load_for_static_cache_associations
126   super
127 end