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
127 def allow_lazy_load_for_static_cache_associations
128   # :nocov:
129   if defined?(::Sequel::Plugins::StaticCache::ClassMethods)
130   # :nocov:
131     @association_reflections.each_value do |ref|
132       if ref.associated_class.is_a?(::Sequel::Plugins::StaticCache::ClassMethods)
133         ref[:forbid_lazy_load] = false
134       end
135     end
136   end
137 end
finalize_associations()

Allow lazy loading for static cache associations before finalizing.

[show source]
    # File lib/sequel/plugins/forbid_lazy_load.rb
140 def finalize_associations
141   allow_lazy_load_for_static_cache_associations
142   super
143 end