diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 2f823e1..4233e5e 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -24,11 +24,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3'] - activerecord: ['7.0', '7.1', '7.2'] + ruby-version: ['3.1', '3.2', '3.3', '3.4'] + activerecord: ['7.2', '8.0', '8.1'] exclude: - - ruby-version: '3.0' - activerecord: '7.2' + # Rails 8.x requires Ruby >= 3.2 + - ruby-version: '3.1' + activerecord: '8.0' + - ruby-version: '3.1' + activerecord: '8.1' env: BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile steps: diff --git a/Appraisals b/Appraisals index 1a4b83f..61506e0 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,11 @@ -appraise "rails-7.0" do - gem 'rails', '~> 7.0' +appraise "rails-7.2" do + gem 'rails', '~> 7.2.0' end -appraise "rails-7.1" do - gem 'rails', '~> 7.1' +appraise "rails-8.0" do + gem 'rails', '~> 8.0.0' end -appraise "rails-7.2" do - gem 'rails', '~> 7.2' +appraise "rails-8.1" do + gem 'rails', '~> 8.1.0' end diff --git a/active_record-acts_as.gemspec b/active_record-acts_as.gemspec index e5d9466..767900a 100644 --- a/active_record-acts_as.gemspec +++ b/active_record-acts_as.gemspec @@ -9,8 +9,8 @@ Gem::Specification.new do |spec| spec.authors = ["Hassan Zamani", "Manuel Meurer", "Bivan Alzacky Harmanto", "Adi Suryanata Herwana"] spec.email = ["hsn.zamani@gmail.com", "manuel@krautcomputing.com"] spec.summary = %q{Simulate multi-table inheritance for activerecord models} - spec.description = %q{Simulate multi-table inheritance for activerecord models using a plymorphic association} - spec.homepage = "http://github.com/krautcomputing/active_record-acts_as" + spec.description = %q{Simulate multi-table inheritance for activerecord models using a polymorphic association} + spec.homepage = "https://github.com/Coursemology/active_record-acts_as" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0") @@ -18,16 +18,15 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = ">= 3.1" - spec.add_development_dependency "sqlite3", "~> 1.7" + spec.add_development_dependency "sqlite3", ">= 2.1" spec.add_development_dependency "bundler" spec.add_development_dependency "rspec", "~> 3" - spec.add_development_dependency "psych", "3.3.2" spec.add_development_dependency "rake" spec.add_development_dependency "appraisal", "~> 2.1" spec.add_development_dependency "guard-rspec", "~> 4.7" - spec.add_dependency "activesupport", ">= 7.0" - spec.add_dependency "activerecord", ">= 7.0" + spec.add_dependency "activesupport", ">= 7.2" + spec.add_dependency "activerecord", ">= 7.2" end diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile index 261dd6c..0331410 100644 --- a/gemfiles/rails_7.2.gemfile +++ b/gemfiles/rails_7.2.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "coveralls_reborn", require: false -gem "rails", "~> 7.2" +gem "rails", "~> 7.2.0" gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_8.0.gemfile similarity index 84% rename from gemfiles/rails_7.0.gemfile rename to gemfiles/rails_8.0.gemfile index 0a5bb37..6fc7aaa 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_8.0.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "coveralls_reborn", require: false -gem "rails", "~> 7.0" +gem "rails", "~> 8.0.0" gemspec path: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_8.1.gemfile similarity index 84% rename from gemfiles/rails_7.1.gemfile rename to gemfiles/rails_8.1.gemfile index 558b853..89fa44a 100644 --- a/gemfiles/rails_7.1.gemfile +++ b/gemfiles/rails_8.1.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "coveralls_reborn", require: false -gem "rails", "~> 7.1" +gem "rails", "~> 8.1.0" gemspec path: "../" diff --git a/lib/active_record/acts_as/instance_methods.rb b/lib/active_record/acts_as/instance_methods.rb index 40ca870..96c88b4 100644 --- a/lib/active_record/acts_as/instance_methods.rb +++ b/lib/active_record/acts_as/instance_methods.rb @@ -93,13 +93,14 @@ def column_for_attribute(name) end end - # Rails 6 introduces the additional argument time, which allows the setup of time - # while touching the model (updating the updated_at or anything time-related). How- - # ever, since our Coursemology usage does not need this, we don't add the arg here. - def touch(*args) + # Rails 6+ adds a `time:` keyword to #touch. Rails' own deferred-touch flow + # (TouchLater#touch_deferred_attributes, run in before_committed!) calls `touch(time:)`, so the + # override MUST accept it — otherwise the kwarg hash is misread as a column name and raises + # ActiveModel::MissingAttributeError. Mirrors upstream (chaadow) v5.x. + def touch(*args, time: nil) self_args, acting_as_args = args.partition { |arg| has_attribute?(arg, true) } - super(*self_args) if self_args.any? - acting_as.touch(*acting_as_args) if acting_as.persisted? + super(*self_args, time: time) if self_args.any? + acting_as.touch(*acting_as_args, time: time) if acting_as.persisted? end def respond_to?(name, include_private = false, as_original_class = false) diff --git a/lib/active_record/acts_as/version.rb b/lib/active_record/acts_as/version.rb index 62ef070..55fc8ba 100644 --- a/lib/active_record/acts_as/version.rb +++ b/lib/active_record/acts_as/version.rb @@ -1,5 +1,5 @@ module ActiveRecord module ActsAs - VERSION = "4.0.1" + VERSION = "4.1.0" end end diff --git a/spec/actable_spec.rb b/spec/actable_spec.rb index 9ccdc3e..0e0e431 100644 --- a/spec/actable_spec.rb +++ b/spec/actable_spec.rb @@ -49,11 +49,11 @@ it "raises NoMethodError for undefined methods on specific" do pen.save - if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.3.0') - expect{ pen.product.raise_error }.to raise_error(NoMethodError, /undefined method `non_existant_method' for #