From 6752d79bed99386083cd89b69001f2a7db775fd0 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 5 Oct 2023 18:53:51 +0200 Subject: [PATCH] Connect to the database before checking PG version Close #236 Ref: rails/rails#49378 --- lib/active_record/connection_adapters/chronomodel_adapter.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/active_record/connection_adapters/chronomodel_adapter.rb b/lib/active_record/connection_adapters/chronomodel_adapter.rb index 59f4fae..6c7575a 100644 --- a/lib/active_record/connection_adapters/chronomodel_adapter.rb +++ b/lib/active_record/connection_adapters/chronomodel_adapter.rb @@ -29,6 +29,9 @@ def chronomodel_connection(config) # :nodoc: adapter = ChronoModel::Adapter.new(conn, logger, conn_params, config) + # Rails 7.2.0, see ifad/chronomodel#236 + adapter.connect! if adapter.respond_to?(:connect!) + unless adapter.chrono_supported? raise ChronoModel::Error, 'Your database server is not supported by ChronoModel. ' \ 'Currently, only PostgreSQL >= 9.3 is supported.'