diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea801042..4e194e49 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,11 +59,15 @@ jobs: # have set this up with each database as a separate job, but then we'd be # duplicating the matrix configuration three times. matrix: - gemfile: [ 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2' ] + gemfile: [ 'rails_6.1', 'rails_7.0', 'rails_7.1', 'rails_7.2', 'rails_8.0' ] # To keep matrix size down, only test highest and lowest rubies. # See "Lowest supported ruby version" in CONTRIBUTING.md ruby: [ '3.1', '3.3' ] + exclude: + # Rails 8 requires ruby 3.2+. + - gemfile: 'rails_8.0' + ruby: '3.1' steps: - name: Checkout source uses: actions/checkout@v4 diff --git a/Appraisals b/Appraisals index a76050d0..115cbb56 100644 --- a/Appraisals +++ b/Appraisals @@ -28,3 +28,9 @@ appraise "rails-7.2" do gem "rails", "~> 7.2.0" gem "rails-controller-testing", "~> 1.0.5" end + +appraise "rails-8.0" do + gem "rails", "~> 8.0.0.rc1" + gem "rails-controller-testing", "~> 1.0.5" + gem "sqlite3", ">= 2.1" +end diff --git a/CHANGELOG.md b/CHANGELOG.md index c97d772b..5f5b0ab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/). ### Added +- [#1498](https://github.com/paper-trail-gem/paper_trail/pull/1498) - + Rails 8.0 - [#1422](https://github.com/paper-trail-gem/paper_trail/pull/1450) - Add `version_error_behavior` config config option to control error handling when creating/updating/deleting `Version` records. diff --git a/README.md b/README.md index 69bf2b4e..970d1e66 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,9 @@ Choose version: | paper_trail | ruby | activerecord | |-------------|----------|---------------| -| unreleased | >= 3.1.0 | >= 6.1, <= 7.2 | +| unreleased | >= 3.1.0 | >= 6.1, <= 8.0 | +| 15.2 | >= 3.1.0 | >= 6.1, <= 7.2 | +| 15.1 | >= 3.1.0 | >= 6.1, <= 7.1 | | 15 | >= 3.0.0 | >= 6.1, < 7.2 | | 14 | >= 2.7.0 | >= 6.0, < 7.1 | | 13 | >= 2.6.0 | >= 5.2, < 7.1 | diff --git a/gemfiles/rails_8.0.gemfile b/gemfiles/rails_8.0.gemfile new file mode 100644 index 00000000..aee6dfbf --- /dev/null +++ b/gemfiles/rails_8.0.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 8.0.0.rc1" +gem "rails-controller-testing", "~> 1.0.5" +gem "sqlite3", ">= 2.1" + +gemspec path: "../" diff --git a/lib/paper_trail/compatibility.rb b/lib/paper_trail/compatibility.rb index 820382b9..cfb6f2cd 100644 --- a/lib/paper_trail/compatibility.rb +++ b/lib/paper_trail/compatibility.rb @@ -18,7 +18,7 @@ module PaperTrail # versions. module Compatibility ACTIVERECORD_GTE = ">= 6.1" # enforced in gemspec - ACTIVERECORD_LT = "< 7.3" # not enforced in gemspec + ACTIVERECORD_LT = "< 8.1" # not enforced in gemspec E_INCOMPATIBLE_AR = <<-EOS PaperTrail %s is not compatible with ActiveRecord %s. We allow PT diff --git a/spec/dummy_app/app/models/post_with_status.rb b/spec/dummy_app/app/models/post_with_status.rb index 3a408adf..35c58760 100644 --- a/spec/dummy_app/app/models/post_with_status.rb +++ b/spec/dummy_app/app/models/post_with_status.rb @@ -5,5 +5,9 @@ class PostWithStatus < ApplicationRecord has_paper_trail - enum status: { draft: 0, published: 1, archived: 2 } + if ActiveRecord::VERSION::MAJOR >= 7 + enum :status, { draft: 0, published: 1, archived: 2 } + else + enum status: { draft: 0, published: 1, archived: 2 } + end end diff --git a/spec/paper_trail/compatibility_spec.rb b/spec/paper_trail/compatibility_spec.rb index f503ea89..f2c30e2b 100644 --- a/spec/paper_trail/compatibility_spec.rb +++ b/spec/paper_trail/compatibility_spec.rb @@ -14,7 +14,7 @@ module PaperTrail context "when incompatible" do it "writes a warning to stderr" do - ar_version = ::Gem::Version.new("8.0.0") + ar_version = ::Gem::Version.new("8.1.0") expect { described_class.check_activerecord(ar_version) }.to output(/not compatible/).to_stderr