From c038be33d1bc447eea579e7515a55775fcc0e6b0 Mon Sep 17 00:00:00 2001 From: Mathieu Jobin Date: Thu, 24 Aug 2023 11:08:38 +0900 Subject: [PATCH 01/14] fix Minitest case --- test/paranoia_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/paranoia_test.rb b/test/paranoia_test.rb index e302f6b8..86cc8748 100644 --- a/test/paranoia_test.rb +++ b/test/paranoia_test.rb @@ -3,7 +3,7 @@ require 'minitest/autorun' require 'paranoia' -test_framework = defined?(MiniTest::Test) ? MiniTest::Test : MiniTest::Unit::TestCase +test_framework = defined?(Minitest::Test) ? Minitest::Test : Minitest::Unit::TestCase if ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks=) ActiveRecord::Base.raise_in_transactional_callbacks = true From 3bdb5530521d6ada2c1988ed47de18e929efd34f Mon Sep 17 00:00:00 2001 From: Kensuke Yanase Date: Fri, 1 Sep 2023 09:14:21 +0900 Subject: [PATCH 02/14] Update supported Rails version in paranoia.gemspec (#547) --- paranoia.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paranoia.gemspec b/paranoia.gemspec index febe2afc..3efc2fb1 100644 --- a/paranoia.gemspec +++ b/paranoia.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.license = 'MIT' s.summary = "Paranoia is a re-implementation of acts_as_paranoid for Rails 3, 4, and 5, using much, much, much less code." s.description = <<-DSC - Paranoia is a re-implementation of acts_as_paranoid for Rails 4, 5, 6, and 7, + Paranoia is a re-implementation of acts_as_paranoid for Rails 5, 6, and 7, using much, much, much less code. You would use either plugin / gem if you wished that when you called destroy on an Active Record object that it didn't actually destroy it, but just "hid" the record. Paranoia does this From 4db17c2aa3ac002bf926facd7d95d87cbb372f9f Mon Sep 17 00:00:00 2001 From: Matt Larraz Date: Thu, 31 Aug 2023 20:20:22 -0400 Subject: [PATCH 03/14] Use paranoia_destroyed\? instead of deleted\? (#545) deleted\? might be overridden by other gems, better to use the namespaced method --- lib/paranoia.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 6fc464a5..d6fb1c33 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -60,7 +60,7 @@ def restore(id_or_ids, opts = {}) def paranoia_destroy with_transaction_returning_status do result = run_callbacks(:destroy) do - @_disable_counter_cache = deleted? + @_disable_counter_cache = paranoia_destroyed? result = paranoia_delete next result unless result && ActiveRecord::VERSION::STRING >= '4.2' each_counter_cached_associations do |association| @@ -73,7 +73,7 @@ def paranoia_destroy @_disable_counter_cache = false result end - raise ActiveRecord::Rollback, "Not destroyed" unless self.deleted? + raise ActiveRecord::Rollback, "Not destroyed" unless paranoia_destroyed? result end || false end From 1db84020ac71ff8ebb90bfbbcebc8f2d86f96cbc Mon Sep 17 00:00:00 2001 From: Kensuke Yanase Date: Fri, 1 Sep 2023 10:22:07 +0900 Subject: [PATCH 04/14] Minor optimization, removing unneeded variables (#546) * Remove unused local variable delete dead code that became unused due to changes in commit 9937512664d2338ffe1fe3cd522e84dfbf0cafa6 * group the assignment to the local variable in the same way as the assignment to association_foreign_key * move temporary variables, which are only referenced when association_class.paranoid? is true, inside the conditional branch * simplify association_find_conditions further --------- Co-authored-by: Mathieu Jobin --- lib/paranoia.rb | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index d6fb1c33..0b0d743a 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -216,23 +216,12 @@ def restore_associated_records(recovery_window_range = nil) end if association_data.nil? && association.macro.to_s == "has_one" - association_class_name = association.klass.name - - association_foreign_key = if association.options[:through].present? - association.klass.primary_key - else - association.foreign_key - end - - if association.type - association_polymorphic_type = association.type - association_find_conditions = { association_polymorphic_type => self.class.name.to_s, association_foreign_key => self.id } - else - association_find_conditions = { association_foreign_key => self.id } - end - association_class = association.klass if association_class.paranoid? + association_foreign_key = association.options[:through].present? ? association.klass.primary_key : association.foreign_key + association_find_conditions = { association_foreign_key => self.id } + association_find_conditions[association.type] = self.class.name if association.type + association_class.only_deleted.where(association_find_conditions).first .try!(:restore, recursive: true, :recovery_window_range => recovery_window_range) end From 72a03f14621fa7f16bb8b56a0648be30cddd1c1e Mon Sep 17 00:00:00 2001 From: Chandan Jhunjhunwal Date: Thu, 12 Oct 2023 01:19:29 +0530 Subject: [PATCH 05/14] =?UTF-8?q?Rails=207.1=20Release=20=F0=9F=9A=80=20(#?= =?UTF-8?q?548)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update paranoia.gemspec Co-authored-by: Lachlan Sylvester Rails 7.1 Release 🚀 - Updated CHANGELOG.md and version.rb --- .github/workflows/build.yml | 4 +++- CHANGELOG.md | 6 ++++++ lib/paranoia/version.rb | 2 +- paranoia.gemspec | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd920c3f..4a243071 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,11 +15,13 @@ jobs: strategy: fail-fast: false matrix: - rails: ["~> 7.0.0", "~> 6.1.0", "~> 6.0.0"] + rails: ["~> 7.1.0", "~> 7.0.0", "~> 6.1.0", "~> 6.0.0"] ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"] include: - ruby: 3.2 rails: 'edge' + - ruby: 3.2 + rails: '~> 7.1.0' # single test failure with jruby #- ruby: jruby-9.4 # rails: '~> 7.0.0' diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e93e080..ebd6ac81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # paranoia Changelog +## 2.6.3 + +* [#548](https://github.com/rubysherpas/paranoia/pull/441) Add support for [Rails 7.1](https://github.com/rails/rails/releases/tag/v7.1.0) (#441) + + [Indyarocks](https://github.com/indyarocks) + ## 2.6.2 * [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441) diff --git a/lib/paranoia/version.rb b/lib/paranoia/version.rb index afe1017d..5c5c433d 100644 --- a/lib/paranoia/version.rb +++ b/lib/paranoia/version.rb @@ -1,3 +1,3 @@ module Paranoia - VERSION = '2.6.2'.freeze + VERSION = '2.6.3'.freeze end diff --git a/paranoia.gemspec b/paranoia.gemspec index 3efc2fb1..8e89bb40 100644 --- a/paranoia.gemspec +++ b/paranoia.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.5' - s.add_dependency 'activerecord', '>= 5.1', '< 7.1' + s.add_dependency 'activerecord', '>= 5.1', '< 7.2' s.add_development_dependency "bundler", ">= 1.0.0" s.add_development_dependency "rake" From a0b7632ae14c939b18470f2e1f5fc621e62f678c Mon Sep 17 00:00:00 2001 From: mishina <32959831+mishina2228@users.noreply.github.com> Date: Wed, 18 Oct 2023 08:17:02 +0900 Subject: [PATCH 06/14] Bump actions/checkout from v2 to v4 (#550) GitHub Actions workflow prints the following warning. > The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/ This PR updates actions/checkout to v4 in order to suppress the warning. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a243071..a603c725 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: env: RAILS: ${{ matrix.rails }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} From de744931c8212c09d2f45d8f2d653c5672bda316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A9=20Dupuis?= <1518299+JoeDupuis@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:03:03 -0700 Subject: [PATCH 07/14] Support prebuilt counter cache association list (#554) - ahead of Rails 7.2 releases --- lib/paranoia.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 0b0d743a..05f15b08 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -173,8 +173,25 @@ def really_destroy!(update_destroy_attributes: true) private + def counter_cache_disabled? + defined?(@_disable_counter_cache) && @_disable_counter_cache + end + + def counter_cached_association_names + return [] if counter_cache_disabled? + super + end + def each_counter_cached_associations - !(defined?(@_disable_counter_cache) && @_disable_counter_cache) ? super : [] + return [] if counter_cache_disabled? + + if defined?(super) + super + else + counter_cached_association_names.each do |name| + yield association(name) + end + end end def paranoia_restore_attributes From f68cb236a01209ccbe91430341ae5846b933cdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chary=C5=82o?= Date: Tue, 12 Mar 2024 12:08:12 +0100 Subject: [PATCH 08/14] fix: restore has_one with scope (#551) * test: simplify HasOneWithScope relation config * test: add has_one restore by accident test case * test: imporove has_one_with_scope_missed --- lib/paranoia.rb | 19 ++++++++++++------- test/paranoia_test.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 05f15b08..7024c83c 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -210,6 +210,16 @@ def timestamp_attributes_with_current_time timestamp_attributes_for_update_in_model.each_with_object({}) { |attr,hash| hash[attr] = current_time_from_proper_timezone } end + def paranoia_find_has_one_target(association) + association_foreign_key = association.options[:through].present? ? association.klass.primary_key : association.foreign_key + association_find_conditions = { association_foreign_key => self.id } + association_find_conditions[association.type] = self.class.name if association.type + + scope = association.klass.only_deleted.where(association_find_conditions) + scope = scope.merge(association.scope) if association.scope + scope.first + end + # restore associated records that have been soft deleted when # we called #destroy def restore_associated_records(recovery_window_range = nil) @@ -233,13 +243,8 @@ def restore_associated_records(recovery_window_range = nil) end if association_data.nil? && association.macro.to_s == "has_one" - association_class = association.klass - if association_class.paranoid? - association_foreign_key = association.options[:through].present? ? association.klass.primary_key : association.foreign_key - association_find_conditions = { association_foreign_key => self.id } - association_find_conditions[association.type] = self.class.name if association.type - - association_class.only_deleted.where(association_find_conditions).first + if association.klass.paranoid? + paranoia_find_has_one_target(association) .try!(:restore, recursive: true, :recovery_window_range => recovery_window_range) end end diff --git a/test/paranoia_test.rb b/test/paranoia_test.rb index 86cc8748..14be4d0e 100644 --- a/test/paranoia_test.rb +++ b/test/paranoia_test.rb @@ -54,6 +54,7 @@ def setup! 'empty_paranoid_models' => 'deleted_at DATETIME', 'paranoid_has_one_throughs' => 'paranoid_has_through_restore_parent_id INTEGER NOT NULL, empty_paranoid_model_id INTEGER NOT NULL, deleted_at DATETIME', 'paranoid_has_many_throughs' => 'paranoid_has_through_restore_parent_id INTEGER NOT NULL, empty_paranoid_model_id INTEGER NOT NULL, deleted_at DATETIME', + 'paranoid_has_one_with_scopes' => 'deleted_at DATETIME, kind STRING, paranoid_has_one_with_scope_id INTEGER', }.each do |table_name, columns_as_sql_string| ActiveRecord::Base.connection.execute "CREATE TABLE #{table_name} (id INTEGER NOT NULL PRIMARY KEY, #{columns_as_sql_string})" end @@ -1223,6 +1224,37 @@ def test_counter_cache_column_on_restore end end + def test_has_one_with_scope_missed + parent = ParanoidHasOneWithScope.create + gamma = ParanoidHasOneWithScope.create(kind: :gamma, paranoid_has_one_with_scope: parent) # this has to be first + alpha = ParanoidHasOneWithScope.create(kind: :alpha, paranoid_has_one_with_scope: parent) + beta = ParanoidHasOneWithScope.create(kind: :beta, paranoid_has_one_with_scope: parent) + + parent.destroy + assert !gamma.reload.destroyed? + gamma.destroy + assert_equal 0, ParanoidHasOneWithScope.count # all destroyed + parent.reload # we unload associations + parent.restore(recursive: true) + + assert_equal "alpha", parent.alpha&.kind, "record was not restored" + assert_equal "beta", parent.beta&.kind, "record was not restored" + assert_nil parent.gamma, "record was incorrectly restored" + end + + def test_has_one_with_scope_not_restored + parent = ParanoidHasOneWithScope.create + gamma = ParanoidHasOneWithScope.create(kind: :gamma, paranoid_has_one_with_scope: parent) + parent.destroy + assert_equal 1, ParanoidHasOneWithScope.count # gamma not deleted + gamma.destroy + parent.reload # we unload associations + parent.restore(recursive: true) + + assert gamma.reload.deleted?, "the record was incorrectly restored" + assert_equal 1, ParanoidHasOneWithScope.count # gamma deleted + end + private def get_featureful_model FeaturefulModel.new(:name => "not empty") @@ -1627,3 +1659,11 @@ class ParanoidHasManyThrough < ActiveRecord::Base belongs_to :paranoid_has_through_restore_parent belongs_to :empty_paranoid_model, dependent: :destroy end + +class ParanoidHasOneWithScope < ActiveRecord::Base + acts_as_paranoid + has_one :alpha, -> () { where(kind: :alpha) }, class_name: "ParanoidHasOneWithScope", dependent: :destroy + has_one :beta, -> () { where(kind: :beta) }, class_name: "ParanoidHasOneWithScope", dependent: :destroy + has_one :gamma, -> () { where(kind: :gamma) }, class_name: "ParanoidHasOneWithScope" + belongs_to :paranoid_has_one_with_scope +end From 0f8a3bdb082f9f5928ed2665cadcd98ac5ceab5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Thu, 21 Mar 2024 01:54:13 +0100 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=93=9D=20Add=20Yard=20documentation?= =?UTF-8?q?=20for=20Paranoia::Query=20(#555)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/paranoia.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/paranoia.rb b/lib/paranoia.rb index 7024c83c..b69b4402 100644 --- a/lib/paranoia.rb +++ b/lib/paranoia.rb @@ -24,6 +24,7 @@ def self.included(klazz) module Query def paranoid? ; true ; end + # If you want to find all records, even those which are deleted def with_deleted if ActiveRecord::VERSION::STRING >= "4.1" return unscope where: paranoia_column @@ -31,6 +32,7 @@ def with_deleted all.tap { |x| x.default_scoped = false } end + # If you want to find only the deleted records def only_deleted if paranoia_sentinel_value.nil? return with_deleted.where.not(paranoia_column => paranoia_sentinel_value) @@ -45,6 +47,7 @@ def only_deleted end alias_method :deleted, :only_deleted + # If you want to restore a record def restore(id_or_ids, opts = {}) ids = Array(id_or_ids).flatten any_object_instead_of_id = ids.any? { |id| ActiveRecord::Base === id } From c3b432e621a749782043036bb6f39165ac8f0f60 Mon Sep 17 00:00:00 2001 From: Mathieu Jobin Date: Sat, 20 Jul 2024 09:10:12 +0900 Subject: [PATCH 10/14] Release v2.6.4: bump version and update Changelog --- CHANGELOG.md | 22 ++++++++++++++++------ lib/paranoia/version.rb | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebd6ac81..9dbe020d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,32 @@ # paranoia Changelog -## 2.6.3 +## 2.6.4 - July 20, 2024 -* [#548](https://github.com/rubysherpas/paranoia/pull/441) Add support for [Rails 7.1](https://github.com/rails/rails/releases/tag/v7.1.0) (#441) - +Add support for [Rails 7.2](https://github.com/rails/rails/releases/tag/v7.2.0) + +* [#554](https://github.com/rubysherpas/paranoia/pull/554) Support prebuilt counter cache association list (#554) + [Joé Dupuis](https://github.com/JoeDupuis) +* [#551](https://github.com/rubysherpas/paranoia/pull/551) Fix: restore has_one with scope (#551) + [Paweł Charyło](https://github.com/zygzagZ) +* [#555](https://github.com/rubysherpas/paranoia/pull/555) 📝 Add Yard documentation for Paranoia::Query (#555) + [Clément Prod'homme](https://github.com/cprodhomme) + +## 2.6.3 - Oct 12, 2023 + +* [#548](https://github.com/rubysherpas/paranoia/pull/548) Add support for [Rails 7.1](https://github.com/rails/rails/releases/tag/v7.1.0) (#548) [Indyarocks](https://github.com/indyarocks) -## 2.6.2 +## 2.6.2 - Jun 6, 2023 * [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441) [Emil Ong](https://github.com/emilong) -## 2.6.1 +## 2.6.1 - Nov 16, 2022 * [#535](https://github.com/rubysherpas/paranoia/pull/535) Allow to skip updating paranoia_destroy_attributes for records while really_destroy! [Anton Bogdanov](https://github.com/kortirso) -## 2.6.0 +## 2.6.0 - Mar 23, 2022 * [#512](https://github.com/rubysherpas/paranoia/pull/512) Quote table names; Mysql 8 has keywords that might match table names which cause an exception. * [#476](https://github.com/rubysherpas/paranoia/pull/476) Fix syntax error in documentation. diff --git a/lib/paranoia/version.rb b/lib/paranoia/version.rb index 5c5c433d..626ba581 100644 --- a/lib/paranoia/version.rb +++ b/lib/paranoia/version.rb @@ -1,3 +1,3 @@ module Paranoia - VERSION = '2.6.3'.freeze + VERSION = '2.6.4'.freeze end From 9790ee12e169801820e0ec1cc013202396454f1e Mon Sep 17 00:00:00 2001 From: Andrew Hampton Date: Mon, 12 Aug 2024 22:38:48 -0400 Subject: [PATCH 11/14] Add support for Rails 7.2 (#563) * Add support for Rails 7.2 * Remove Rails 7.2 changelog entry v2.6.4 doesn't actually support Rails 7.2, so drop this item from the changelog. --- .github/workflows/build.yml | 8 +++++++- CHANGELOG.md | 2 -- Gemfile | 2 +- paranoia.gemspec | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a603c725..b5504116 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - rails: ["~> 7.1.0", "~> 7.0.0", "~> 6.1.0", "~> 6.0.0"] + rails: ["~> 7.2.0", "~> 7.1.0", "~> 7.0.0", "~> 6.1.0", "~> 6.0.0"] ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"] include: - ruby: 3.2 @@ -39,6 +39,12 @@ jobs: rails: '~> 5.2.0' - ruby: 2.5 rails: '~> 5.1.0' + exclude: + # Rails 7.2.0 requires Ruby 3.1.0 or later + - ruby: "3.0.6" + rails: "~> 7.2.0" + - ruby: "2.7.8" + rails: "~> 7.2.0" #os: ubuntu-latest #arch: x64 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dbe020d..5e25af2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ ## 2.6.4 - July 20, 2024 -Add support for [Rails 7.2](https://github.com/rails/rails/releases/tag/v7.2.0) - * [#554](https://github.com/rubysherpas/paranoia/pull/554) Support prebuilt counter cache association list (#554) [Joé Dupuis](https://github.com/JoeDupuis) * [#551](https://github.com/rubysherpas/paranoia/pull/551) Fix: restore has_one with scope (#551) diff --git a/Gemfile b/Gemfile index fe5f736b..66ecd287 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ sqlite = ENV['SQLITE_VERSION'] if sqlite gem 'sqlite3', sqlite, platforms: [:ruby] else - gem 'sqlite3', platforms: [:ruby] + gem 'sqlite3', '~> 1.4', platforms: [:ruby] end platforms :jruby do diff --git a/paranoia.gemspec b/paranoia.gemspec index 8e89bb40..c87485f6 100644 --- a/paranoia.gemspec +++ b/paranoia.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.5' - s.add_dependency 'activerecord', '>= 5.1', '< 7.2' + s.add_dependency 'activerecord', '>= 5.1', '< 8.0' s.add_development_dependency "bundler", ">= 1.0.0" s.add_development_dependency "rake" From 4d7b87d6628864b919a65a407d6a8fc19507bb33 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Tue, 13 Aug 2024 12:54:17 +1000 Subject: [PATCH 12/14] See what happens on Rails edge (#564) * See what happens on Rails edge * Tweak support for Ruby 2.7 * Add Ruby exclusions * Correct exclusion syntax --- .github/workflows/build.yml | 43 +++++++++++-------------------------- CHANGELOG.md | 6 +++++- paranoia.gemspec | 4 ++-- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5504116..66c036d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,38 +15,19 @@ jobs: strategy: fail-fast: false matrix: - rails: ["~> 7.2.0", "~> 7.1.0", "~> 7.0.0", "~> 6.1.0", "~> 6.0.0"] - ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"] - include: - - ruby: 3.2 - rails: 'edge' - - ruby: 3.2 - rails: '~> 7.1.0' - # single test failure with jruby - #- ruby: jruby-9.4 - # rails: '~> 7.0.0' - - ruby: 2.6 - rails: '~> 6.1.0' - - ruby: 2.6 - rails: '~> 6.0.0' - - ruby: 2.6 - rails: '~> 5.2.0' - - ruby: 2.6 - rails: '~> 5.1.0' - - ruby: 2.5 - rails: '~> 6.0.0' - - ruby: 2.5 - rails: '~> 5.2.0' - - ruby: 2.5 - rails: '~> 5.1.0' + rails: ["edge", "~> 7.2.0", "~> 7.1.0", "~> 7.0.0", "~> 6.1.0"] + ruby: ["3.3","3.2", "3.1", "3.0", "2.7"] exclude: - # Rails 7.2.0 requires Ruby 3.1.0 or later - - ruby: "3.0.6" - rails: "~> 7.2.0" - - ruby: "2.7.8" - rails: "~> 7.2.0" - #os: ubuntu-latest - #arch: x64 + - rails: "~> 7.2.0" + ruby: "3.0" + - rails: "~> 7.2.0" + ruby: "2.7" + - rails: "edge" + ruby: "3.0" + - rails: "edge" + ruby: "2.7" + + env: RAILS: ${{ matrix.rails }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e25af2f..071d160d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # paranoia Changelog +## 3.0.0 - August 13, 2024 + +- [#563](https://github.com/rubysherpas/paranoia/pull/563) Support Rails 7.2 & Rails 8.0 + ## 2.6.4 - July 20, 2024 * [#554](https://github.com/rubysherpas/paranoia/pull/554) Support prebuilt counter cache association list (#554) @@ -16,7 +20,7 @@ ## 2.6.2 - Jun 6, 2023 -* [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441) +* [#441](https://github.com/rubysherpas/paranoia/pull/441) Recursive restore with has_many/one through assocs (#441) [Emil Ong](https://github.com/emilong) ## 2.6.1 - Nov 16, 2022 diff --git a/paranoia.gemspec b/paranoia.gemspec index c87485f6..9baf38e6 100644 --- a/paranoia.gemspec +++ b/paranoia.gemspec @@ -22,9 +22,9 @@ Gem::Specification.new do |s| s.required_rubygems_version = ">= 1.3.6" - s.required_ruby_version = '>= 2.5' + s.required_ruby_version = '>= 2.7' - s.add_dependency 'activerecord', '>= 5.1', '< 8.0' + s.add_dependency 'activerecord', '>= 6', '< 8.1' s.add_development_dependency "bundler", ">= 1.0.0" s.add_development_dependency "rake" From 3faf7d372ebe30b67cf49e89f6f71e72464388d5 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Tue, 13 Aug 2024 12:54:46 +1000 Subject: [PATCH 13/14] Document support for Rails edge + 7.2 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 071d160d..ffb76447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ## 3.0.0 - August 13, 2024 -- [#563](https://github.com/rubysherpas/paranoia/pull/563) Support Rails 7.2 & Rails 8.0 +_Tagged as 3.0 as Ruby + Rails version constraints have been modernised._ + +- [#564](https://github.com/rubysherpas/paranoia/pull/564) Support Rails edge +- [#563](https://github.com/rubysherpas/paranoia/pull/563) Support Rails 7.2 ## 2.6.4 - July 20, 2024 From f441c378c3fb4a3c8beb482db376ac14717f81a7 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Tue, 13 Aug 2024 12:56:17 +1000 Subject: [PATCH 14/14] Bump to 3.0.0 --- lib/paranoia/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/paranoia/version.rb b/lib/paranoia/version.rb index 626ba581..16735463 100644 --- a/lib/paranoia/version.rb +++ b/lib/paranoia/version.rb @@ -1,3 +1,3 @@ module Paranoia - VERSION = '2.6.4'.freeze + VERSION = '3.0.0'.freeze end