Sha256: 8bc8f6c2d3c50628ab4907de65c388734e77e65c1608f856050188fe68dda7c7

Contents?: true

Size: 783 Bytes

Versions: 3

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module Goldiloader
  module Compatibility
    ACTIVE_RECORD_VERSION = ::Gem::Version.new(::ActiveRecord::VERSION::STRING).release
    RAILS_5_2_0 = ACTIVE_RECORD_VERSION == ::Gem::Version.new('5.2.0')

    def self.pre_rails_7?
      ::ActiveRecord::VERSION::MAJOR < 7
    end

    def self.rails_5_2?
      ::ActiveRecord::VERSION::MAJOR == 5 && ::ActiveRecord::VERSION::MINOR == 2
    end

    def self.rails_6_1?
      ::ActiveRecord::VERSION::MAJOR == 6 && ::ActiveRecord::VERSION::MINOR == 1
    end

    def self.rails_6_1_or_greater?
      ::ActiveRecord::VERSION::MAJOR > 6 || rails_6_1?
    end

    # See https://github.com/rails/rails/pull/32375
    def self.destroyed_model_associations_eager_loadable?
      !RAILS_5_2_0
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
goldiloader-4.2.1 lib/goldiloader/compatibility.rb
goldiloader-4.2.0 lib/goldiloader/compatibility.rb
goldiloader-4.1.2 lib/goldiloader/compatibility.rb