Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix deprecation warning

Christophe Bliard4fca1eaaea8e
diff --git a/config/application.rb b/config/application.rb
index 40e0a24d387..d2635a094cc 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -64,6 +64,14 @@ module OpenProject
# files. See https://community.openproject.org/wp/45463 for details.
# config.load_defaults 5.0
+ # Use new connection handling API. For most applications this won't have any
+ # effect. For applications using multiple databases, this new API provides
+ # support for granular connection swapping.
+ # It has to be done here to prevent having the deprecation warning
+ # displayed. This line and its comment can safely be removed
+ # once `config.load_defaults 6.1` is used.
+ config.active_record.legacy_connection_handling = false
+
# Sets up logging for STDOUT and configures the default logger formatter
# so that all environments receive level and timestamp information
#
diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb
index 4ce326bc5a4..728e9dcf26b 100644
--- a/config/initializers/new_framework_defaults_6_1.rb
+++ b/config/initializers/new_framework_defaults_6_1.rb
@@ -57,8 +57,8 @@
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
-# Previous versions had false. Rails 6.1+ default is true.
-# Rails.application.config.active_record.legacy_connection_handling = false
+# Previous versions had true. Rails 6.1+ default is false.
+Rails.application.config.active_record.legacy_connection_handling = false
# https://guides.rubyonrails.org/configuring.html#config-action-view-form-with-generates-remote-forms
# Make `form_with` generate non-remote forms by default.