From 487d3b2bafce5898da93ca44d4606fa00307ae22 Mon Sep 17 00:00:00 2001 From: Jan Graichen Date: Sat, 31 Aug 2024 14:19:00 +0200 Subject: [PATCH 1/2] feat: Support Rails 7.2 --- .github/workflows/ci.yml | 5 ++++- Gemfile | 2 +- Gemfile.rails-7-2 | 5 +++++ active_record_upsert.gemspec | 2 +- lib/active_record_upsert.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 Gemfile.rails-7-2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa91dbe..bb7a60b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,10 @@ jobs: - ruby-version: "3.2" gemfile: Gemfile.rails-7-1 experimental: false - - ruby-version: "3.2" + - ruby-version: "3.3" + gemfile: Gemfile.rails-7-2 + experimental: false + - ruby-version: "3.3" gemfile: Gemfile.rails-main experimental: true diff --git a/Gemfile b/Gemfile index 575fd06..e60eb72 100644 --- a/Gemfile +++ b/Gemfile @@ -1 +1 @@ -eval_gemfile "#{__dir__}/Gemfile.rails-5-2" +eval_gemfile "#{__dir__}/Gemfile.rails-7-2" diff --git a/Gemfile.rails-7-2 b/Gemfile.rails-7-2 new file mode 100644 index 0000000..833063f --- /dev/null +++ b/Gemfile.rails-7-2 @@ -0,0 +1,5 @@ +group :development, :test do + gem 'rails', '~> 7.2.0' +end + +eval_gemfile "#{__dir__}/Gemfile.base" diff --git a/active_record_upsert.gemspec b/active_record_upsert.gemspec index 1dc79d5..9a71e4a 100644 --- a/active_record_upsert.gemspec +++ b/active_record_upsert.gemspec @@ -21,6 +21,6 @@ Gem::Specification.new do |spec| spec.platform = Gem::Platform::RUBY - spec.add_runtime_dependency 'activerecord', '>= 5.2', '< 7.2' + spec.add_runtime_dependency 'activerecord', '>= 5.2', '< 8.0' spec.add_runtime_dependency 'pg', '>= 0.18', '< 2.0' end diff --git a/lib/active_record_upsert.rb b/lib/active_record_upsert.rb index b452bf1..e2dfdf3 100644 --- a/lib/active_record_upsert.rb +++ b/lib/active_record_upsert.rb @@ -13,7 +13,7 @@ version = defined?(Rails) ? Rails.version : ActiveRecord.version.to_s -require 'active_record_upsert/compatibility/rails70.rb' if version >= '7.0.0' && version < '7.2.0' +require 'active_record_upsert/compatibility/rails70.rb' if version >= '7.0.0' && version < '8.0.0' require 'active_record_upsert/compatibility/rails60.rb' if version >= '6.0.0' && version < '6.2.0' module ActiveRecordUpsert From dacff05b15951ef262168d17a5f62703f60a4b8a Mon Sep 17 00:00:00 2001 From: Jan Graichen Date: Sat, 31 Aug 2024 14:33:12 +0200 Subject: [PATCH 2/2] fix: Load latest compat module by default Unless the latest compatiblity module is loaded for any newer Rails version, current Rails dev versions won't pass CI. Fixes #140 --- lib/active_record_upsert.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/active_record_upsert.rb b/lib/active_record_upsert.rb index e2dfdf3..63e0b04 100644 --- a/lib/active_record_upsert.rb +++ b/lib/active_record_upsert.rb @@ -13,8 +13,11 @@ version = defined?(Rails) ? Rails.version : ActiveRecord.version.to_s -require 'active_record_upsert/compatibility/rails70.rb' if version >= '7.0.0' && version < '8.0.0' -require 'active_record_upsert/compatibility/rails60.rb' if version >= '6.0.0' && version < '6.2.0' +if version >= '7.0.0' + require 'active_record_upsert/compatibility/rails70.rb' +elsif version >= '6.0.0' && version < '6.2.0' + require 'active_record_upsert/compatibility/rails60.rb' +end module ActiveRecordUpsert # Your code goes here...