Module: Thredded::Compat

Defined in:
lib/thredded/compat.rb

Class Method Summary collapse

Class Method Details

.association_preloader(records:, associations:, scope:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO: inline this or put it somewhere else as it’s no longer specific to a rails version



20
21
22
23
24
# File 'lib/thredded/compat.rb', line 20

def association_preloader(records:, associations:, scope:)
  ActiveRecord::Associations::Preloader.new(
    records: records, associations: associations, scope: scope
  ).call
end

.rails_gte_71?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/thredded/compat.rb', line 7

def rails_gte_71?
  @rails_gte_71 = (Rails.gem_version >= Gem::Version.new('7.1.0')) if @rails_gte_71.nil?
  @rails_gte_71
end

.rails_gte_72?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/thredded/compat.rb', line 13

def rails_gte_72?
  @rails_gte_72 = (Rails.gem_version >= Gem::Version.new('7.2.0')) if @rails_gte_72.nil?
  @rails_gte_72
end