Skip to content

Commit

Permalink
Rails 5 support is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
benlangfeld committed Jan 2, 2024
1 parent 87b0bf3 commit 40c9020
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,15 @@
Kernel.srand config.seed
end

# This shim is for Rails 5.2 compatibility in the test
# This shim is for Rails 7.1 compatibility in the test
module Rails5Compatibility
module Migrator
def initialize(direction, migrations, schema_migration_or_target_version = nil, target_version = nil)
if schema_migration_or_target_version == ActiveRecord::SchemaMigration
super(direction, migrations, target_version)
else
super(direction, migrations, schema_migration_or_target_version)
end
end
end

module MigrationContext
def initialize(migrations_paths, schema_migration = nil)
super(migrations_paths)
end
end
end

if ActiveRecord::VERSION::MAJOR < 6
ActiveRecord::Migrator.send :prepend, Rails5Compatibility::Migrator
ActiveRecord::MigrationContext.send :prepend, Rails5Compatibility::MigrationContext
end

if ActiveRecord::VERSION::STRING >= '7.1'
ActiveRecord::MigrationContext.send :prepend, Rails5Compatibility::MigrationContext
end

0 comments on commit 40c9020

Please sign in to comment.