diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index a6ab871..be508ec 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -16,49 +16,20 @@ jobs: - "3.2" - "3.1" - "3.0" - - "2.7" - - "2.6" gemfile: + - gemfiles/rails_8.0.gemfile - gemfiles/rails_7.2.gemfile - gemfiles/rails_7.1.gemfile - gemfiles/rails_7.0.gemfile - - gemfiles/rails_6.1.gemfile - - gemfiles/rails_6.0.gemfile - - gemfiles/rails_5.2.gemfile exclude: - - gemfile: gemfiles/rails_7.2.gemfile - ruby: "3.0" - - gemfile: gemfiles/rails_7.2.gemfile - ruby: "2.7" - - gemfile: gemfiles/rails_7.2.gemfile - ruby: "2.6" - - gemfile: gemfiles/rails_7.1.gemfile - ruby: "2.6" - - gemfile: gemfiles/rails_7.0.gemfile - ruby: "2.6" - - gemfile: gemfiles/rails_6.1.gemfile - ruby: "3.3" - - gemfile: gemfiles/rails_6.1.gemfile - ruby: "3.2" - - gemfile: gemfiles/rails_6.1.gemfile + - gemfile: gemfiles/rails_8.0.gemfile ruby: "3.1" - - gemfile: gemfiles/rails_6.0.gemfile - ruby: "3.3" - - gemfile: gemfiles/rails_6.0.gemfile - ruby: "3.2" - - gemfile: gemfiles/rails_6.0.gemfile - ruby: "3.1" - - gemfile: gemfiles/rails_6.0.gemfile + - gemfile: gemfiles/rails_8.0.gemfile ruby: "3.0" - - gemfile: gemfiles/rails_5.2.gemfile - ruby: "3.3" - - gemfile: gemfiles/rails_5.2.gemfile - ruby: "3.2" - - gemfile: gemfiles/rails_5.2.gemfile - ruby: "3.1" - - gemfile: gemfiles/rails_5.2.gemfile + - gemfile: gemfiles/rails_7.2.gemfile ruby: "3.0" + env: BUNDLE_GEMFILE: ${{ format('{0}/{1}', github.workspace, matrix.gemfile) }} BUNDLE_PATH: ${{ format('{0}/vendor/bundle', github.workspace) }} diff --git a/Appraisals b/Appraisals index 84d6eea..a771a64 100644 --- a/Appraisals +++ b/Appraisals @@ -1,25 +1,17 @@ # frozen_string_literal: true -appraise "rails-5.2" do - gem 'activemodel', '~> 5.2.8.1' -end - -appraise "rails-6.0" do - gem 'activemodel', '~> 6.0.6.1' -end - -appraise "rails-6.1" do - gem 'activemodel', '~> 6.1.7.6' -end - appraise "rails-7.0" do - gem 'activemodel', '~> 7.0.8.4' + gem 'activemodel', '~> 7.0.8.6' end appraise "rails-7.1" do - gem 'activemodel', '~> 7.1.4' + gem 'activemodel', '~> 7.1.5' end appraise "rails-7.2" do - gem 'activemodel', '~> 7.2.1' + gem 'activemodel', '~> 7.2.2' +end + +appraise "rails-8.0" do + gem 'activemodel', '~> 8.0.0' end diff --git a/Gemfile.lock b/Gemfile.lock index fba761c..2a6d86d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: nested_record (1.1.2) - activemodel (> 5.2, < 8.0) + activemodel (> 7.0, < 8.1) GEM remote: https://rubygems.org/ diff --git a/gemfiles/rails_5.2.gemfile.lock b/gemfiles/rails_5.2.gemfile.lock deleted file mode 100644 index 69c1d13..0000000 --- a/gemfiles/rails_5.2.gemfile.lock +++ /dev/null @@ -1,57 +0,0 @@ -PATH - remote: .. - specs: - nested_record (1.1.2) - activemodel (> 5.2, < 8.0) - -GEM - remote: https://rubygems.org/ - specs: - activemodel (5.2.8.1) - activesupport (= 5.2.8.1) - activesupport (5.2.8.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - appraisal (2.5.0) - bundler - rake - thor (>= 0.14.0) - concurrent-ruby (1.3.4) - diff-lcs (1.5.1) - i18n (1.14.5) - concurrent-ruby (~> 1.0) - minitest (5.25.1) - rake (13.2.1) - rspec (3.13.0) - rspec-core (~> 3.13.0) - rspec-expectations (~> 3.13.0) - rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) - rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-support (3.13.1) - thor (1.3.2) - thread_safe (0.3.6) - tzinfo (1.2.11) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - activemodel (~> 5.2.8.1) - appraisal - bundler (>= 2) - nested_record! - rake (~> 13.0) - rspec (~> 3.0) - -BUNDLED WITH - 2.3.22 diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile deleted file mode 100644 index 3073b40..0000000 --- a/gemfiles/rails_6.0.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "activemodel", "~> 6.0.6.1" - -gemspec path: "../" diff --git a/gemfiles/rails_6.0.gemfile.lock b/gemfiles/rails_6.0.gemfile.lock deleted file mode 100644 index a3f39e7..0000000 --- a/gemfiles/rails_6.0.gemfile.lock +++ /dev/null @@ -1,59 +0,0 @@ -PATH - remote: .. - specs: - nested_record (1.1.2) - activemodel (> 5.2, < 8.0) - -GEM - remote: https://rubygems.org/ - specs: - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activesupport (6.0.6.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) - appraisal (2.5.0) - bundler - rake - thor (>= 0.14.0) - concurrent-ruby (1.3.4) - diff-lcs (1.5.1) - i18n (1.14.5) - concurrent-ruby (~> 1.0) - minitest (5.25.1) - rake (13.2.1) - rspec (3.13.0) - rspec-core (~> 3.13.0) - rspec-expectations (~> 3.13.0) - rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) - rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-support (3.13.1) - thor (1.3.2) - thread_safe (0.3.6) - tzinfo (1.2.11) - thread_safe (~> 0.1) - zeitwerk (2.6.18) - -PLATFORMS - ruby - -DEPENDENCIES - activemodel (~> 6.0.6.1) - appraisal - bundler (>= 2) - nested_record! - rake (~> 13.0) - rspec (~> 3.0) - -BUNDLED WITH - 2.4.20 diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile deleted file mode 100644 index 64b942d..0000000 --- a/gemfiles/rails_6.1.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "activemodel", "~> 6.1.7.6" - -gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 8864094..3aaabfc 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "activemodel", "~> 7.0.8.4" +gem "activemodel", "~> 7.0.8.6" gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile.lock b/gemfiles/rails_7.0.gemfile.lock index 7672ff7..a5b32f4 100644 --- a/gemfiles/rails_7.0.gemfile.lock +++ b/gemfiles/rails_7.0.gemfile.lock @@ -2,14 +2,14 @@ PATH remote: .. specs: nested_record (1.1.2) - activemodel (> 5.2, < 8.0) + activemodel (> 7.0, < 8.1) GEM remote: https://rubygems.org/ specs: - activemodel (7.0.8.4) - activesupport (= 7.0.8.4) - activesupport (7.0.8.4) + activemodel (7.0.8.6) + activesupport (= 7.0.8.6) + activesupport (7.0.8.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -20,7 +20,7 @@ GEM thor (>= 0.14.0) concurrent-ruby (1.3.4) diff-lcs (1.5.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) minitest (5.25.1) rake (13.2.1) @@ -28,12 +28,12 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) @@ -45,7 +45,7 @@ PLATFORMS ruby DEPENDENCIES - activemodel (~> 7.0.8.4) + activemodel (~> 7.0.8.6) appraisal bundler (>= 2) nested_record! @@ -53,4 +53,4 @@ DEPENDENCIES rspec (~> 3.0) BUNDLED WITH - 2.4.20 + 2.5.19 diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile index b515993..38696f3 100644 --- a/gemfiles/rails_7.1.gemfile +++ b/gemfiles/rails_7.1.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "activemodel", "~> 7.1.4" +gem "activemodel", "~> 7.1.5" gemspec path: "../" diff --git a/gemfiles/rails_7.1.gemfile.lock b/gemfiles/rails_7.1.gemfile.lock index 6c5ea31..b0e57a8 100644 --- a/gemfiles/rails_7.1.gemfile.lock +++ b/gemfiles/rails_7.1.gemfile.lock @@ -2,35 +2,40 @@ PATH remote: .. specs: nested_record (1.1.2) - activemodel (> 5.2, < 8.0) + activemodel (> 7.0, < 8.1) GEM remote: https://rubygems.org/ specs: - activemodel (7.1.4) - activesupport (= 7.1.4) - activesupport (7.1.4) + activemodel (7.1.5) + activesupport (= 7.1.5) + activesupport (7.1.5) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) appraisal (2.5.0) bundler rake thor (>= 0.14.0) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) concurrent-ruby (1.3.4) connection_pool (2.4.1) diff-lcs (1.5.1) drb (2.2.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) + logger (1.6.1) minitest (5.25.1) mutex_m (0.2.0) rake (13.2.1) @@ -38,15 +43,16 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) + securerandom (0.3.1) thor (1.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -55,7 +61,7 @@ PLATFORMS ruby DEPENDENCIES - activemodel (~> 7.1.4) + activemodel (~> 7.1.5) appraisal bundler (>= 2) nested_record! @@ -63,4 +69,4 @@ DEPENDENCIES rspec (~> 3.0) BUNDLED WITH - 2.4.20 + 2.5.19 diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile index 9aef0bb..70eb3a4 100644 --- a/gemfiles/rails_7.2.gemfile +++ b/gemfiles/rails_7.2.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "activemodel", "~> 7.2.1" +gem "activemodel", "~> 7.2.2" gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile.lock b/gemfiles/rails_7.2.gemfile.lock index edf2851..28918bc 100644 --- a/gemfiles/rails_7.2.gemfile.lock +++ b/gemfiles/rails_7.2.gemfile.lock @@ -2,15 +2,16 @@ PATH remote: .. specs: nested_record (1.1.2) - activemodel (> 5.2, < 8.0) + activemodel (> 7.0, < 8.1) GEM remote: https://rubygems.org/ specs: - activemodel (7.2.1) - activesupport (= 7.2.1) - activesupport (7.2.1) + activemodel (7.2.2) + activesupport (= 7.2.2) + activesupport (7.2.2) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -25,12 +26,13 @@ GEM rake thor (>= 0.14.0) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) concurrent-ruby (1.3.4) connection_pool (2.4.1) diff-lcs (1.5.1) drb (2.2.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) logger (1.6.1) minitest (5.25.1) @@ -39,12 +41,12 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) @@ -58,7 +60,7 @@ PLATFORMS ruby DEPENDENCIES - activemodel (~> 7.2.1) + activemodel (~> 7.2.2) appraisal bundler (>= 2) nested_record! @@ -66,4 +68,4 @@ DEPENDENCIES rspec (~> 3.0) BUNDLED WITH - 2.5.5 + 2.5.19 diff --git a/gemfiles/rails_5.2.gemfile b/gemfiles/rails_8.0.gemfile similarity index 74% rename from gemfiles/rails_5.2.gemfile rename to gemfiles/rails_8.0.gemfile index 60ef567..41c8f7f 100644 --- a/gemfiles/rails_5.2.gemfile +++ b/gemfiles/rails_8.0.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "activemodel", "~> 5.2.8.1" +gem "activemodel", "~> 8.0.0" gemspec path: "../" diff --git a/gemfiles/rails_6.1.gemfile.lock b/gemfiles/rails_8.0.gemfile.lock similarity index 57% rename from gemfiles/rails_6.1.gemfile.lock rename to gemfiles/rails_8.0.gemfile.lock index bb8d942..21caf28 100644 --- a/gemfiles/rails_6.1.gemfile.lock +++ b/gemfiles/rails_8.0.gemfile.lock @@ -2,52 +2,67 @@ PATH remote: .. specs: nested_record (1.1.2) - activemodel (> 5.2, < 8.0) + activemodel (> 7.0, < 8.1) GEM remote: https://rubygems.org/ specs: - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activesupport (6.1.7.8) - concurrent-ruby (~> 1.0, >= 1.0.2) + activemodel (8.0.0) + activesupport (= 8.0.0) + activesupport (8.0.0) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) appraisal (2.5.0) bundler rake thor (>= 0.14.0) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) concurrent-ruby (1.3.4) + connection_pool (2.4.1) diff-lcs (1.5.1) - i18n (1.14.5) + drb (2.2.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) + logger (1.6.1) minitest (5.25.1) rake (13.2.1) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.1) + rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) + securerandom (0.3.1) thor (1.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - zeitwerk (2.6.18) + uri (1.0.1) PLATFORMS ruby + x86_64-linux DEPENDENCIES - activemodel (~> 6.1.7.6) + activemodel (~> 8.0.0) appraisal bundler (>= 2) nested_record! @@ -55,4 +70,4 @@ DEPENDENCIES rspec (~> 3.0) BUNDLED WITH - 2.4.20 + 2.5.19 diff --git a/lib/nested_record/lookup_const.rb b/lib/nested_record/lookup_const.rb index fef3a7b..95dccca 100644 --- a/lib/nested_record/lookup_const.rb +++ b/lib/nested_record/lookup_const.rb @@ -1,23 +1,12 @@ # frozen_string_literal: true module NestedRecord - # TODO: Remove this when we drop support for Rails < 7.0 - if ActiveSupport::VERSION::MAJOR < 7 - def self.constantize(type_name) - ActiveSupport::Dependencies.constantize(type_name) - end - - def self.safe_constantize(type_name) - ActiveSupport::Dependencies.safe_constantize(type_name) - end - else - def self.constantize(type_name) - type_name.constantize - end + def self.constantize(type_name) + type_name.constantize + end - def self.safe_constantize(type_name) - type_name.safe_constantize - end + def self.safe_constantize(type_name) + type_name.safe_constantize end # Derived from Rails source: https://github.com/rails/rails/blob/98a57aa5f610bc66af31af409c72173cdeeb3c9e/activerecord/lib/active_record/inheritance.rb#L181-L207 diff --git a/nested_record.gemspec b/nested_record.gemspec index 08721a7..2c2d3e5 100644 --- a/nested_record.gemspec +++ b/nested_record.gemspec @@ -27,5 +27,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "appraisal" - spec.add_dependency "activemodel", "> 5.2", "< 8.0" + spec.add_dependency "activemodel", "> 7.0", "< 8.1" end