Sha256: 26b6db3835913497739b30dc4a7f2c13a1904e82e34e5aabd1b007d326dcba7e

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

module Thredded
  module Compat
    class << self
      # @api private
      def rails_gte_61?
        @rails_gte_61 = (Rails.gem_version >= Gem::Version.new('6.1.0')) if @rails_gte_61.nil?
        @rails_gte_61
      end

      if Rails.gem_version >= Gem::Version.new('7.0.0')
        # @api private
        def association_preloader(records:, associations:, scope:)
          ActiveRecord::Associations::Preloader.new(
            records: records, associations: associations, scope: scope
          ).call
        end
      else
        # @api private
        def association_preloader(records:, associations:, scope:)
          ActiveRecord::Associations::Preloader.new.preload(
            records, associations, scope
          )
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thredded-1.1.0 lib/thredded/compat.rb