DmitryTsepelev/ar_lazy_preload

View on GitHub
lib/ar_lazy_preload/active_record/association.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module ArLazyPreload
  # ActiveRecord::Association patch with a hook for lazy preloading
  module Association
    def load_target
      owner.try_preload_lazily(reflection.name)
      super
    end
  end
end