diff --git a/spec/support/paper_trail_spec_migrator.rb b/spec/support/paper_trail_spec_migrator.rb index f53903cb..7a368e22 100644 --- a/spec/support/paper_trail_spec_migrator.rb +++ b/spec/support/paper_trail_spec_migrator.rb @@ -21,7 +21,7 @@ def initialize def migrate ::ActiveRecord::MigrationContext.new( @migrations_path, - ::ActiveRecord::Base.connection.schema_migration + schema_migration ).migrate end @@ -45,6 +45,14 @@ def generate_and_migrate(generator, generator_invoke_args) private + def schema_migration + if Rails::VERSION::STRING >= '7.2' + ::ActiveRecord::Base.connection_pool.schema_migration + else + ::ActiveRecord::Base.connection.schema_migration + end + end + def dummy_app_migrations_dir Pathname.new(File.expand_path("../dummy_app/db/migrate", __dir__)) end