DEV: Upgrade Rails to version 7.2

This commit is contained in:
Loïc Guitaut
2024-08-19 14:44:17 +02:00
committed by Loïc Guitaut
parent f4d0a77d5f
commit d6bec460a8
30 changed files with 93 additions and 151 deletions

View File

@@ -2,10 +2,7 @@
# Multisite freedom patch defines RailsMultisite::DiscoursePatches.config which is used by 200-first_middlewares.rb
# Therefore it can not be postponed with .to_prepare
RUN_WITHOUT_PREPARE = [
"#{Rails.root}/lib/freedom_patches/rails_multisite.rb",
"#{Rails.root}/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb",
]
RUN_WITHOUT_PREPARE = ["#{Rails.root}/lib/freedom_patches/rails_multisite.rb"]
RUN_WITHOUT_PREPARE.each { |path| require(path) }
Rails.application.reloader.to_prepare do

View File

@@ -44,7 +44,7 @@ if defined?(RailsFailover::ActiveRecord)
# Test connection to the master, and trigger master failover if needed
ActiveRecord::Base.connected_to(role: ActiveRecord.writing_role) do
ActiveRecord::Base.connection.active?
ActiveRecord::Base.connection.connect!.active?
rescue PG::ConnectionBad, PG::UnableToSend, PG::ServerError
RailsFailover::ActiveRecord.verify_primary(ActiveRecord.writing_role)
end

View File

@@ -3,7 +3,7 @@
# On initialize, reset flags cache
Rails.application.config.to_prepare do
if Discourse.cache.is_a?(Cache) &&
!ActiveRecord::Base.connection.migration_context.needs_migration?
!ActiveRecord::Base.connection_pool.migration_context.needs_migration?
Flag.reset_flag_settings!
end
end