From 5b91cb90c5147941544a6d84dc9b1526920caf8f Mon Sep 17 00:00:00 2001 From: Hayden Ball Date: Mon, 28 Dec 2020 16:05:31 +0000 Subject: [PATCH 1/4] Spread keyword args to support Ruby 3 --- lib/active_model/validations/date_validator.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/active_model/validations/date_validator.rb b/lib/active_model/validations/date_validator.rb index 0bb03d1..422d0c4 100644 --- a/lib/active_model/validations/date_validator.rb +++ b/lib/active_model/validations/date_validator.rb @@ -59,19 +59,19 @@ def validate_each(record, attr_name, value) end if value_before_type_cast.present? && value.nil? - record.errors.add(attr_name, :not_a_date, options) + record.errors.add(attr_name, :not_a_date, **options) return end return if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank]) unless value - record.errors.add(attr_name, :not_a_date, options) + record.errors.add(attr_name, :not_a_date, **options) return end unless is_time?(value) - record.errors.add(attr_name, :not_a_date, options) + record.errors.add(attr_name, :not_a_date, **options) return end @@ -94,7 +94,7 @@ def validate_each(record, attr_name, value) end unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i) - record.errors.add(attr_name, :"date_#{option}", options.merge( + record.errors.add(attr_name, :"date_#{option}", **options.merge( value: original_value, date: (I18n.localize(original_option_value) rescue original_option_value) )) From 3912c811a1494d928a86c551500ee5b7ed97fe51 Mon Sep 17 00:00:00 2001 From: Hayden Ball Date: Mon, 28 Dec 2020 16:15:11 +0000 Subject: [PATCH 2/4] Add ActiveModel 6.1 to CI run --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 724ed2a..ba98a2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7] - activemodel: [3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0] + activemodel: [3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0, 6.1] exclude: - ruby: 2.2 activemodel: 6.0 @@ -26,6 +26,12 @@ jobs: activemodel: 6.0 - ruby: 2.4 activemodel: 6.0 + - ruby: 2.2 + activemodel: 6.1 + - ruby: 2.3 + activemodel: 6.1 + - ruby: 2.4 + activemodel: 6.1 fail-fast: true env: ACTIVE_MODEL_VERSION: ${{ matrix.activemodel }} From 26c424c5ccf41bd6d3a497b95984fbcb377d6796 Mon Sep 17 00:00:00 2001 From: Hayden Ball Date: Tue, 29 Dec 2020 14:36:40 +0000 Subject: [PATCH 3/4] Include Ruby 3.0 in CI --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba98a2f..7e4f6f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,11 @@ jobs: matrix: ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7] activemodel: [3.2, 4.0, 4.1, 4.2, 5.0, 5.1, 5.2, 6.0, 6.1] + include: + - ruby: 3.0 + activemodel: 6.0 + - ruby: 3.0 + activemodel: 6.1 exclude: - ruby: 2.2 activemodel: 6.0 From fda505be02af1545eab18211c95fe9a015f117a3 Mon Sep 17 00:00:00 2001 From: Hayden Ball Date: Tue, 29 Dec 2020 14:41:05 +0000 Subject: [PATCH 4/4] Remove dependency on std libs Tests are now only run against MRI --- Gemfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Gemfile b/Gemfile index 8e6f8da..ad1689a 100755 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,3 @@ active_model_opts = end gem 'activemodel', active_model_opts - -platforms :rbx do - gem 'rubysl', '~> 2.0' -end