module Sequel::Plugins::ForbidLazyLoad::ClassMethods

  1. lib/sequel/plugins/forbid_lazy_load.rb

Public Instance methods

allow_lazy_load_for_static_cache_associations()

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.

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

Allow lazy loading for static cache associations before finalizing.

[show source]
    # File lib/sequel/plugins/forbid_lazy_load.rb
126 def finalize_associations
127   allow_lazy_load_for_static_cache_associations
128   super
129 end