Skip to content

Commit 1f78519

Browse files
remove rails 6.x support
1 parent da258ba commit 1f78519

File tree

8 files changed

+11
-49
lines changed

8 files changed

+11
-49
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
gemfile:
17-
- Gemfile.rails-6.1-stable
1817
- Gemfile.rails-7.0-stable
1918
- Gemfile.rails-7.2-stable
2019
- Gemfile.rails-8.0-stable

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@
3030

3131
### Added
3232

33-
- Add Rails 8.0 compatibility (requires Ruby 3.2+)
33+
- Add Rails 8.0 compatibility (requires Ruby 3.2+)
34+
35+
### Removed
36+
- Remove unsupported rails versions 6.x

Rakefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,7 @@ namespace :db do
3131
desc 'Migrate the database'
3232
task :migrate do
3333
ActiveRecord::Base.establish_connection(database_config)
34-
35-
# Handle different Rails versions
36-
active_record_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
37-
38-
if active_record_version >= Gem::Version.new("6.0")
39-
ActiveRecord::MigrationContext.new(migration_path).migrate
40-
else
41-
ActiveRecord::Migrator.migrate(migration_path)
42-
end
43-
34+
ActiveRecord::MigrationContext.new(migration_path).migrate
4435
Rake::Task['db:schema'].invoke
4536
puts 'Database migrated.'
4637
end

gemfiles/Gemfile.rails-6.1-stable

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/polymorphic_integer_type/activerecord_5_0_0/polymorphic_array_value_extension.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ module PolymorphicArrayValueExtension
1010
# end
1111

1212
def type_to_ids_mapping
13-
if ACTIVE_RECORD_VERSION < Gem::Version.new("6.1")
14-
association = @associated_table.send(:association)
15-
else
16-
association = @associated_table.send(:reflection)
17-
end
13+
association = @associated_table.send(:reflection)
1814

1915
name = association.name
2016
default_hash = Hash.new { |hsh, key| hsh[key] = [] }

lib/polymorphic_integer_type/belongs_to_polymorphic_association_extension.rb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@ module Associations
33
class BelongsToPolymorphicAssociation < BelongsToAssociation
44
private
55

6-
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("6.1")
7-
def replace_keys(record)
8-
super
9-
owner[reflection.foreign_type] = record.class.base_class unless record.nil?
10-
end
11-
elsif
12-
def replace_keys(record, force: false)
13-
super
14-
owner[reflection.foreign_type] = record.class.base_class unless record.nil?
15-
end
6+
def replace_keys(record, force: false)
7+
super
8+
owner[reflection.foreign_type] = record.class.base_class unless record.nil?
169
end
1710
end
1811
end

lib/polymorphic_integer_type/extensions.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,7 @@ def remove_integer_type_and_set_attributes_and_extension(integer_type_values, re
118118
if is_polymorphic_integer
119119
reflection.foreign_integer_type = foreign_integer_type
120120
reflection.integer_type = integer_type
121-
122-
if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("6.1")
123-
ActiveRecord::Associations::Association.prepend(PolymorphicIntegerType::PolymorphicForeignAssociationExtension)
124-
else
125-
ActiveRecord::Associations::ForeignAssociation.prepend(PolymorphicIntegerType::PolymorphicForeignAssociationExtension)
126-
end
121+
ActiveRecord::Associations::ForeignAssociation.prepend(PolymorphicIntegerType::PolymorphicForeignAssociationExtension)
127122
end
128123
end
129124

spec/spec_helper.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@
2020
config.before(:suite) do
2121
database_config = YAML.load(File.open("#{File.dirname(__FILE__)}/support/database.yml"))
2222
migrations_path = "#{File.dirname(__FILE__)}/support/migrations"
23-
active_record_version = Gem::Version.new(ActiveRecord::VERSION::STRING)
2423

2524
ActiveRecord::Base.establish_connection(database_config)
26-
27-
if active_record_version >= Gem::Version.new("6.1") && active_record_version < Gem::Version.new("7.0")
28-
ActiveRecord::MigrationContext.new(migrations_path, ActiveRecord::SchemaMigration).migrate
29-
end
3025

31-
if active_record_version >= Gem::Version.new("7.0")
32-
ActiveRecord::MigrationContext.new(migrations_path).migrate
33-
end
26+
ActiveRecord::MigrationContext.new(migrations_path).migrate
3427
end
3528

3629
config.around do |example|

0 commit comments

Comments
 (0)