From 337f613db139ba2bfd7fb38492b21b3e593552e6 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Wed, 27 May 2026 15:10:08 +0200 Subject: [PATCH 1/6] Add ruby 4.0 to the CI --- .github/workflows/test.yml | 52 ++++++++++++++++++++++++++------------ Gemfile | 1 + 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5c3478..9b7c7aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,22 @@ name: CI RSpec Test on: [push, pull_request] jobs: + rubocop: + runs-on: ubuntu-latest + env: + CI: true + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby 3.4 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.4 + bundler-cache: true + - name: Run RuboCop + run: bundle exec rubocop --parallel + build: - name: >- - ${{ matrix.ruby }} + name: "${{ matrix.ruby }} mongoid-${{ matrix.mongoid }}" env: CI: true TESTOPTS: -v @@ -14,18 +27,29 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.7, 3.0, 3.1, 3.2] - mongoid: [7, 8] + ruby: + - ruby-2.7 + - ruby-3.0 + - ruby-3.1 + - ruby-3.2 + - ruby-3.3 + - ruby-3.4 + - ruby-4.0 + - truffleruby + mongoid: + - '8.0' + - '8.1' + - '9.0' experimental: [false] include: - - ruby: 3.2 - mongoid: HEAD + - ruby: ruby-3.2 + mongoid: head experimental: true - - ruby: head + - ruby: ruby-head mongoid: 7 experimental: true - - ruby: head - mongoid: HEAD + - ruby: ruby-head + mongoid: head experimental: true - ruby: jruby mongoid: 8 @@ -33,6 +57,9 @@ jobs: - ruby: jruby-head mongoid: 8 experimental: true + - ruby: truffleruby-head + mongoid: 7 + experimental: true steps: - name: repo checkout @@ -55,13 +82,6 @@ jobs: env: MONGOID_VERSION: ${{ matrix.mongoid }} - - name: rubocop - timeout-minutes: 5 - run: bundle exec rubocop - continue-on-error: ${{ matrix.experimental }} - env: - MONGOID_VERSION: ${{ matrix.mongoid }} - - name: test timeout-minutes: 10 run: bundle exec rake spec diff --git a/Gemfile b/Gemfile index 308aac2..ad97cf7 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ end gem 'danger', require: false gem 'danger-changelog', require: false gem 'danger-pr-comment', require: false +gem 'ostruct' gem 'rake' gem 'rspec' gem 'rspec-its' From 6a98f2aac0372071929c52f62f8bc8e0bc77d001 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Wed, 27 May 2026 15:19:32 +0200 Subject: [PATCH 2/6] Remove mongoid 8.0 from the test matrix --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b7c7aa..bc567e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,10 +36,7 @@ jobs: - ruby-3.4 - ruby-4.0 - truffleruby - mongoid: - - '8.0' - - '8.1' - - '9.0' + mongoid: [8, 9] experimental: [false] include: - ruby: ruby-3.2 From a993a54f0284ebc8db670fdaef1ea2034e12367e Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Wed, 27 May 2026 15:49:36 +0200 Subject: [PATCH 3/6] fix(unique-embedded-slugs): Fix unique embedded slugs with mongoid 9.0 fix #276 --- lib/mongoid/slug/unique_slug.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/mongoid/slug/unique_slug.rb b/lib/mongoid/slug/unique_slug.rb index 3132129..bb8c90a 100644 --- a/lib/mongoid/slug/unique_slug.rb +++ b/lib/mongoid/slug/unique_slug.rb @@ -145,6 +145,11 @@ def regex_for_slug end def uniqueness_scope + if embedded? + parent_metadata = reflect_on_all_association(:embedded_in)[0] + return model._parent.send(parent_metadata.inverse_of || metadata.name) + end + # If slug_scope is present, we need to handle whether it's a single scope or multiple scopes. if slug_scope # We'll track individual scope results in an array. @@ -190,13 +195,6 @@ def uniqueness_scope return model.class end - # The rest of your method remains unchanged, handling cases where slug_scope isn't defined. - # This is your existing logic for embedded models or deeper superclass retrieval. - if embedded? - parent_metadata = reflect_on_all_association(:embedded_in)[0] - return model._parent.send(parent_metadata.inverse_of || self.metadata.name) - end - # Unless embedded or slug scope, return the deepest document superclass. appropriate_class = model.class appropriate_class = appropriate_class.superclass while appropriate_class.superclass.include?(Mongoid::Document) From cf695f2d9954f9c4c6da5c78b3e3a35eee0f322b Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Fri, 29 May 2026 15:56:50 +0200 Subject: [PATCH 4/6] Remove support for truffleruby and mongoid-head --- .github/workflows/test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bc567e7..2bc575e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,19 +35,12 @@ jobs: - ruby-3.3 - ruby-3.4 - ruby-4.0 - - truffleruby mongoid: [8, 9] experimental: [false] include: - - ruby: ruby-3.2 - mongoid: head - experimental: true - ruby: ruby-head mongoid: 7 experimental: true - - ruby: ruby-head - mongoid: head - experimental: true - ruby: jruby mongoid: 8 experimental: true From d89af089fec988cfdf8b2a3dc406385991fd20b8 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Fri, 29 May 2026 15:59:04 +0200 Subject: [PATCH 5/6] Add suport for mongoid HEAD --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2bc575e..d4adcae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,9 +38,15 @@ jobs: mongoid: [8, 9] experimental: [false] include: + - ruby: ruby-3.2 + mongoid: HEAD + experimental: true - ruby: ruby-head mongoid: 7 experimental: true + - ruby: ruby-head + mongoid: HEAD + experimental: true - ruby: jruby mongoid: 8 experimental: true From 95b3e21bd3414d74cf53cf33129e0695b3689739 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Fri, 29 May 2026 16:02:52 +0200 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bb83ee..39b5d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * [#274](https://github.com/mongoid/mongoid-slug/pull/274): Added support for scoping slugs by multiple fields - [@mikekosulin](https://github.com/mikekosulin). * [#279](https://github.com/mongoid/mongoid-slug/pull/279): Replace deprecated `__find_args__` with `Array#flatten` - [@samiFakhfakhScalingo](https://github.com/samiFakhfakhScalingo), [@aurelien-reeves-scalingo](https://github.com/aurelien-reeves-scalingo). * Your contribution here. +* [#281](https://github.com/mongoid/mongoid-slug/pull/281): Add ruby 4.0 to the ci - [@aurelien-reeves-scalingo](https://github.com/aurelien-reeves-scalingo). ## 7.0.0 (2023/09/18)