-
由 Thong Kuah 创作于
In Rails 7.0, `attribute` definitions in models now run at class definition time, and calls model.connection_db_config. This means swapping the connection_handler now breaks because there's no valid connection_pool within with_disabled_database_connections block. On investigation, `.connection_pool`, and `.connection_db_config` does not create a database connection (model.connection does). In order to have this keep working in Rails 7.0, we switch to counting the number of connections before, and after instead. Also to prevent re-use of connections, we also disconnect all active connections first.
由 Thong Kuah 创作于In Rails 7.0, `attribute` definitions in models now run at class definition time, and calls model.connection_db_config. This means swapping the connection_handler now breaks because there's no valid connection_pool within with_disabled_database_connections block. On investigation, `.connection_pool`, and `.connection_db_config` does not create a database connection (model.connection does). In order to have this keep working in Rails 7.0, we switch to counting the number of connections before, and after instead. Also to prevent re-use of connections, we also disconnect all active connections first.
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。