module ArLazyPreload::Base

ActiveRecord::Base patch with lazy preloading support

Attributes

lazy_preload_context[RW]

Public Class Methods

included(base) click to toggle source
# File lib/ar_lazy_preload/active_record/base.rb, line 6
def self.included(base)
  base.class.delegate :lazy_preload, to: :all
  base.class.delegate :preload_associations_lazily, to: :all
end

Public Instance Methods

skip_preload() click to toggle source
# File lib/ar_lazy_preload/active_record/base.rb, line 15
def skip_preload
  lazy_preload_context&.records&.delete(self)
  self.lazy_preload_context = nil
  self
end