From da13e83d4b40eac7043ca2f8187e7fb6fb8010bd Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 24 Aug 2024 18:22:11 +0200 Subject: [PATCH 1/6] Backport #8450 #8451 to 3.0 stable (#8454) * Update dependencies Relax sqlite3 version constraint because rails/rails#51636 is included in the latest 7.1.4 release * Fix bug report template and update to Rails 7.2 Current bug report template does not work because sqlite3 2.x is not compatible with Rails 7.0.x. This commit also: - Test bug report template against Ruby 3.3 - Set config.eager_load to avoid a warning on stdout: ``` config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly: ``` - Default to `3-0-stable` branch when `ACTIVE_ADMIN_PATH` is not specified - Add `force_ruby_platform` to `sqlite3` for uniformity with `master` branch --- .github/workflows/bug-report-template.yml | 4 +- Gemfile.lock | 151 ++++++++++----------- gemfiles/rails_61/Gemfile.lock | 34 ++--- gemfiles/rails_70/Gemfile.lock | 32 ++--- gemfiles/rails_71/Gemfile | 2 +- gemfiles/rails_71/Gemfile.lock | 153 +++++++++++----------- tasks/bug_report_template.rb | 18 +-- 7 files changed, 200 insertions(+), 194 deletions(-) diff --git a/.github/workflows/bug-report-template.yml b/.github/workflows/bug-report-template.yml index 85e179faf68..48363deb7a9 100644 --- a/.github/workflows/bug-report-template.yml +++ b/.github/workflows/bug-report-template.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: - RUBY_VERSION: ruby-3.2 + RUBY_VERSION: ruby-3.3 jobs: bug_report_template_test: @@ -24,7 +24,7 @@ jobs: if: ${{ github.event_name == 'pull_request' || github.repository_owner == 'activeadmin' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ env.RUBY_VERSION }} diff --git a/Gemfile.lock b/Gemfile.lock index ba7554882c6..d5f509cbab0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,29 +15,29 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.2.0) - actionpack (= 7.2.0) - activesupport (= 7.2.0) + actioncable (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.0) - actionpack (= 7.2.0) - activejob (= 7.2.0) - activerecord (= 7.2.0) - activestorage (= 7.2.0) - activesupport (= 7.2.0) + actionmailbox (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) mail (>= 2.8.0) - actionmailer (7.2.0) - actionpack (= 7.2.0) - actionview (= 7.2.0) - activejob (= 7.2.0) - activesupport (= 7.2.0) + actionmailer (7.2.1) + actionpack (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activesupport (= 7.2.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.0) - actionview (= 7.2.0) - activesupport (= 7.2.0) + actionpack (7.2.1) + actionview (= 7.2.1) + activesupport (= 7.2.1) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -46,39 +46,39 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.0) - actionpack (= 7.2.0) - activerecord (= 7.2.0) - activestorage (= 7.2.0) - activesupport (= 7.2.0) + actiontext (7.2.1) + actionpack (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.0) - activesupport (= 7.2.0) + actionview (7.2.1) + activesupport (= 7.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.0) - activesupport (= 7.2.0) + activejob (7.2.1) + activesupport (= 7.2.1) globalid (>= 0.3.6) - activemodel (7.2.0) - activesupport (= 7.2.0) + activemodel (7.2.1) + activesupport (= 7.2.1) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.2.0) - activemodel (= 7.2.0) - activesupport (= 7.2.0) + activerecord (7.2.1) + activemodel (= 7.2.1) + activesupport (= 7.2.1) timeout (>= 0.4.0) - activestorage (7.2.0) - actionpack (= 7.2.0) - activejob (= 7.2.0) - activerecord (= 7.2.0) - activesupport (= 7.2.0) + activestorage (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activesupport (= 7.2.1) marcel (~> 1.0) - activesupport (7.2.0) + activesupport (7.2.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) @@ -112,8 +112,9 @@ GEM chandler (0.9.0) netrc octokit (>= 2.2.0) - childprocess (5.0.0) - concurrent-ruby (1.3.3) + childprocess (5.1.0) + logger (~> 1.5) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) csv (3.3.0) @@ -138,8 +139,8 @@ GEM bigdecimal cucumber-gherkin (27.0.0) cucumber-messages (>= 19.1.4, < 23) - cucumber-html-formatter (21.4.1) - cucumber-messages (> 19, < 25) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) cucumber-messages (22.0.0) cucumber-rails (3.0.0) capybara (>= 3.11, < 4) @@ -171,7 +172,7 @@ GEM ruby2_keywords drb (2.2.1) erubi (1.13.0) - faraday (2.10.0) + faraday (2.10.1) faraday-net_http (>= 2.0, < 3.2) logger faraday-net_http (3.1.1) @@ -255,7 +256,7 @@ GEM matrix (0.4.2) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) multi_test (1.1.0) net-http (0.4.1) uri @@ -281,10 +282,10 @@ GEM faraday (>= 1, < 3) sawyer (~> 0.9) orm_adapter (0.5.0) - parallel (1.25.1) + parallel (1.26.3) parallel_tests (4.7.1) parallel - parser (3.3.4.0) + parser (3.3.4.2) ast (~> 2.4.1) racc psych (5.1.2) @@ -292,7 +293,7 @@ GEM public_suffix (6.0.1) pundit (2.3.2) activesupport (>= 3.0.0) - racc (1.8.0) + racc (1.8.1) rack (3.1.7) rack-session (2.0.0) rack (>= 3.0.0) @@ -301,20 +302,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.2.0) - actioncable (= 7.2.0) - actionmailbox (= 7.2.0) - actionmailer (= 7.2.0) - actionpack (= 7.2.0) - actiontext (= 7.2.0) - actionview (= 7.2.0) - activejob (= 7.2.0) - activemodel (= 7.2.0) - activerecord (= 7.2.0) - activestorage (= 7.2.0) - activesupport (= 7.2.0) + rails (7.2.1) + actioncable (= 7.2.1) + actionmailbox (= 7.2.1) + actionmailer (= 7.2.1) + actionpack (= 7.2.1) + actiontext (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activemodel (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) bundler (>= 1.15.0) - railties (= 7.2.0) + railties (= 7.2.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -325,9 +326,9 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.2.0) - actionpack (= 7.2.0) - activesupport (= 7.2.0) + railties (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -335,7 +336,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - ransack (4.2.0) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -349,17 +350,17 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.2) + rexml (3.3.6) strscan rspec-core (3.13.0) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.2) 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-rails (6.1.3) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -368,7 +369,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.65.0) + rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -379,7 +380,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.1) parser (>= 3.3.1.0) rubocop-packaging (0.5.2) rubocop (>= 1.33, < 2.0) @@ -388,7 +389,7 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.0.3) + rubocop-rspec (3.0.4) rubocop (~> 1.61) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) @@ -416,14 +417,14 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.7.3) + sqlite3 (2.0.4) mini_portile2 (~> 2.8.0) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86_64-linux) + sqlite3 (2.0.4-arm64-darwin) + sqlite3 (2.0.4-x86_64-linux-gnu) stringio (3.1.1) strscan (3.1.0) sys-uname (1.3.0) @@ -447,7 +448,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.36) - zeitwerk (2.6.16) + zeitwerk (2.6.17) PLATFORMS arm64-darwin @@ -491,4 +492,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.5.16 + 2.5.17 diff --git a/gemfiles/rails_61/Gemfile.lock b/gemfiles/rails_61/Gemfile.lock index edd857f9a6a..e4313962764 100644 --- a/gemfiles/rails_61/Gemfile.lock +++ b/gemfiles/rails_61/Gemfile.lock @@ -104,8 +104,9 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (5.0.0) - concurrent-ruby (1.3.3) + childprocess (5.1.0) + logger (~> 1.5) + concurrent-ruby (1.3.4) crass (1.0.6) csv (3.3.0) cucumber (9.2.0) @@ -129,8 +130,8 @@ GEM bigdecimal cucumber-gherkin (27.0.0) cucumber-messages (>= 19.1.4, < 23) - cucumber-html-formatter (21.4.1) - cucumber-messages (> 19, < 25) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) cucumber-messages (22.0.0) cucumber-rails (3.0.0) capybara (>= 3.11, < 4) @@ -225,6 +226,7 @@ GEM launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (1.6.0) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -238,7 +240,7 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) multi_test (1.1.0) net-imap (0.4.14) date @@ -261,17 +263,17 @@ GEM nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - parallel (1.25.1) + parallel (1.26.3) parallel_tests (4.7.1) parallel - parser (3.3.4.0) + parser (3.3.4.2) ast (~> 2.4.1) racc public_suffix (6.0.1) pundit (2.3.2) activesupport (>= 3.0.0) - racc (1.8.0) - racc (1.8.0-java) + racc (1.8.1) + racc (1.8.1-java) rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) @@ -308,7 +310,7 @@ GEM thor (~> 1.0) rainbow (3.1.1) rake (13.2.1) - ransack (4.2.0) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -320,17 +322,17 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.2) + rexml (3.3.6) strscan rspec-core (3.13.0) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.2) 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-rails (6.1.3) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -360,7 +362,7 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) @@ -390,7 +392,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.6.17) PLATFORMS arm64-darwin @@ -427,4 +429,4 @@ DEPENDENCIES webrick BUNDLED WITH - 2.5.16 + 2.5.17 diff --git a/gemfiles/rails_70/Gemfile.lock b/gemfiles/rails_70/Gemfile.lock index 1e4b30183e8..140fd3cd580 100644 --- a/gemfiles/rails_70/Gemfile.lock +++ b/gemfiles/rails_70/Gemfile.lock @@ -103,8 +103,9 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - childprocess (5.0.0) - concurrent-ruby (1.3.3) + childprocess (5.1.0) + logger (~> 1.5) + concurrent-ruby (1.3.4) crass (1.0.6) csv (3.3.0) cucumber (9.2.0) @@ -128,8 +129,8 @@ GEM bigdecimal cucumber-gherkin (27.0.0) cucumber-messages (>= 19.1.4, < 23) - cucumber-html-formatter (21.4.1) - cucumber-messages (> 19, < 25) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) cucumber-messages (22.0.0) cucumber-rails (3.0.0) capybara (>= 3.11, < 4) @@ -219,6 +220,7 @@ GEM launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (1.6.0) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -232,7 +234,7 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) multi_test (1.1.0) net-imap (0.4.14) date @@ -252,16 +254,16 @@ GEM nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - parallel (1.25.1) + parallel (1.26.3) parallel_tests (4.7.1) parallel - parser (3.3.4.0) + parser (3.3.4.2) ast (~> 2.4.1) racc public_suffix (6.0.1) pundit (2.3.2) activesupport (>= 3.0.0) - racc (1.8.0) + racc (1.8.1) rack (2.2.9) rack-test (2.1.0) rack (>= 1.3) @@ -298,7 +300,7 @@ GEM zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.2.1) - ransack (4.2.0) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -310,17 +312,17 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.2) + rexml (3.3.6) strscan rspec-core (3.13.0) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.2) 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-rails (6.1.3) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -350,7 +352,7 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) @@ -377,7 +379,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.6.17) PLATFORMS arm64-darwin @@ -411,4 +413,4 @@ DEPENDENCIES webrick BUNDLED WITH - 2.5.16 + 2.5.17 diff --git a/gemfiles/rails_71/Gemfile b/gemfiles/rails_71/Gemfile index c8504adf545..f25f1fe769d 100644 --- a/gemfiles/rails_71/Gemfile +++ b/gemfiles/rails_71/Gemfile @@ -31,7 +31,7 @@ group :test do gem "launchy" gem "parallel_tests" gem "rspec-rails" - gem "sqlite3", "~> 1.7", platform: :mri + gem "sqlite3", platform: :mri # Translations gem "i18n-tasks" diff --git a/gemfiles/rails_71/Gemfile.lock b/gemfiles/rails_71/Gemfile.lock index a48bf0a77e3..4953221b670 100644 --- a/gemfiles/rails_71/Gemfile.lock +++ b/gemfiles/rails_71/Gemfile.lock @@ -15,35 +15,35 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + actioncable (7.1.4) + actionpack (= 7.1.4) + activesupport (= 7.1.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionmailbox (7.1.4) + actionpack (= 7.1.4) + activejob (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionmailer (7.1.4) + actionpack (= 7.1.4) + actionview (= 7.1.4) + activejob (= 7.1.4) + activesupport (= 7.1.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.1.4) + actionview (= 7.1.4) + activesupport (= 7.1.4) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -51,39 +51,39 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + actiontext (7.1.4) + actionpack (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (7.1.4) + activesupport (= 7.1.4) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (7.1.4) + activesupport (= 7.1.4) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.1.4) + activesupport (= 7.1.4) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activerecord (7.1.4) + activemodel (= 7.1.4) + activesupport (= 7.1.4) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (7.1.4) + actionpack (= 7.1.4) + activejob (= 7.1.4) + activerecord (= 7.1.4) + activesupport (= 7.1.4) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (7.1.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -116,8 +116,9 @@ GEM chandler (0.9.0) netrc octokit (>= 2.2.0) - childprocess (5.0.0) - concurrent-ruby (1.3.3) + childprocess (5.1.0) + logger (~> 1.5) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) csv (3.3.0) @@ -142,8 +143,8 @@ GEM bigdecimal cucumber-gherkin (27.0.0) cucumber-messages (>= 19.1.4, < 23) - cucumber-html-formatter (21.4.1) - cucumber-messages (> 19, < 25) + cucumber-html-formatter (21.7.0) + cucumber-messages (> 19, < 27) cucumber-messages (22.0.0) cucumber-rails (3.0.0) capybara (>= 3.11, < 4) @@ -175,7 +176,7 @@ GEM ruby2_keywords drb (2.2.1) erubi (1.13.0) - faraday (2.10.0) + faraday (2.10.1) faraday-net_http (>= 2.0, < 3.2) logger faraday-net_http (3.1.1) @@ -259,7 +260,7 @@ GEM matrix (0.4.2) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) multi_test (1.1.0) mutex_m (0.2.0) net-http (0.4.1) @@ -286,10 +287,10 @@ GEM faraday (>= 1, < 3) sawyer (~> 0.9) orm_adapter (0.5.0) - parallel (1.25.1) + parallel (1.26.3) parallel_tests (4.7.1) parallel - parser (3.3.4.0) + parser (3.3.4.2) ast (~> 2.4.1) racc psych (5.1.2) @@ -297,7 +298,7 @@ GEM public_suffix (6.0.1) pundit (2.3.2) activesupport (>= 3.0.0) - racc (1.8.0) + racc (1.8.1) rack (3.1.7) rack-session (2.0.0) rack (>= 3.0.0) @@ -306,20 +307,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rails (7.1.4) + actioncable (= 7.1.4) + actionmailbox (= 7.1.4) + actionmailer (= 7.1.4) + actionpack (= 7.1.4) + actiontext (= 7.1.4) + actionview (= 7.1.4) + activejob (= 7.1.4) + activemodel (= 7.1.4) + activerecord (= 7.1.4) + activestorage (= 7.1.4) + activesupport (= 7.1.4) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 7.1.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -330,9 +331,9 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + railties (7.1.4) + actionpack (= 7.1.4) + activesupport (= 7.1.4) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -340,7 +341,7 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - ransack (4.2.0) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -354,17 +355,17 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.2) + rexml (3.3.6) strscan rspec-core (3.13.0) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.2) 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-rails (6.1.3) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -373,7 +374,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.65.0) + rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -384,7 +385,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.1) parser (>= 3.3.1.0) rubocop-packaging (0.5.2) rubocop (>= 1.33, < 2.0) @@ -393,7 +394,7 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.0.3) + rubocop-rspec (3.0.4) rubocop (~> 1.61) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) @@ -420,14 +421,14 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.5.1) + sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.7.3) + sqlite3 (2.0.4) mini_portile2 (~> 2.8.0) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86_64-linux) + sqlite3 (2.0.4-arm64-darwin) + sqlite3 (2.0.4-x86_64-linux-gnu) stringio (3.1.1) strscan (3.1.0) sys-uname (1.3.0) @@ -450,7 +451,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.36) - zeitwerk (2.6.16) + zeitwerk (2.6.17) PLATFORMS arm64-darwin @@ -489,9 +490,9 @@ DEPENDENCIES simplecov simplecov-cobertura sprockets-rails - sqlite3 (~> 1.7) + sqlite3 webrick yard BUNDLED WITH - 2.5.16 + 2.5.17 diff --git a/tasks/bug_report_template.rb b/tasks/bug_report_template.rb index 27a1395d572..414f72cc182 100644 --- a/tasks/bug_report_template.rb +++ b/tasks/bug_report_template.rb @@ -4,19 +4,20 @@ gemfile(true) do source "https://rubygems.org" - # Use local changes or ActiveAdmin master. + # Use `ACTIVE_ADMIN_PATH=. ruby tasks/bug_report_template.rb` to run + # locally, otherwise run against the default branch. if ENV["ACTIVE_ADMIN_PATH"] gem "activeadmin", path: ENV["ACTIVE_ADMIN_PATH"], require: false else - gem "activeadmin", github: "activeadmin/activeadmin", require: false + gem "activeadmin", github: "activeadmin/activeadmin", branch: "3-0-stable", require: false end # Change Rails version if necessary. - gem "rails", "~> 7.0.0" + gem "rails", "~> 7.2.0" gem "sprockets", "~> 3.7" gem "sassc-rails" - gem "sqlite3", platform: :mri + gem "sqlite3", force_ruby_platform: true, platform: :mri gem "activerecord-jdbcsqlite3-adapter", platform: :jruby # Fixes an issue on CI with default gems when using inline bundle with default @@ -51,14 +52,13 @@ class TestApp < Rails::Application config.root = __dir__ + config.hosts << ".example.com" config.session_store :cookie_store, key: "cookie_store_key" - secrets.secret_token = "secret_token" - secrets.secret_key_base = "secret_key_base" - + config.secret_key_base = "secret_key_base" config.eager_load = false - config.logger = Logger.new($stdout) - config.hosts = "www.example.com" + config.logger = Logger.new($stdout) + Rails.logger = config.logger end class ApplicationController < ActionController::Base From 983cf3a47489c1ec468382354ab14c078adef6a1 Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Wed, 4 Sep 2024 10:35:28 -0300 Subject: [PATCH 2/6] Backport Add favicon to template app to fix Rails 7.2 test suite run (#8468) add favicon for template app We have some specs failing in Rails 7.2. The only hint we have in the log is ``` No route matches [GET] "/favicon.ico" (ActionController::RoutingError) ``` Rails 7.2 new app generator does not use favicon.ico anymore. It uses a png + meta "icon" tag. Let's configure the icon in the template app to prevent this kind of error. --- spec/support/rails_template.rb | 3 ++- spec/support/templates/public/favicon.ico | Bin 0 -> 22382 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 spec/support/templates/public/favicon.ico diff --git a/spec/support/rails_template.rb b/spec/support/rails_template.rb index 7dcd1b6a58d..85f7df8b490 100644 --- a/spec/support/rails_template.rb +++ b/spec/support/rails_template.rb @@ -97,11 +97,12 @@ def self.ransackable_associations(auth_object=nil) # Add some translations append_file "config/locales/en.yml", File.read(File.expand_path("templates/en.yml", __dir__)) -# Add predefined admin resources +# Add predefined admin resources, override any file that was generated by rails new generator directory File.expand_path("templates/admin", __dir__), "app/admin" # Add predefined policies directory File.expand_path("templates/policies", __dir__), "app/policies" +directory File.expand_path("templates/public", __dir__), "public", force: true if ENV["RAILS_ENV"] != "test" inject_into_file "config/routes.rb", "\n root to: redirect('admin')", after: /.*routes.draw do/ diff --git a/spec/support/templates/public/favicon.ico b/spec/support/templates/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..db016de0d55ed4c84f61549cea386bdd93c7f67b GIT binary patch literal 22382 zcmeHPXK+==6@Hmy@+W^XlYjZ;nf!<$ojXU3rRh|a9br_m z`!}6vxWAiHuRBs%k}u_H&r@c=F^Q9MZMQydnwO*ApMK+@`0x8Gw2-E&v0TFHixUaf zT+`9fLF?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#q#}CMx=OA$|%2-XQT{Si8V1nX4+bH~tIPnYV%WCqYr7XAhE~B6$ zZ&HBcQvPSsKb1s!{098zaVf@Rn3rJe0Xh5peu#{bBKRK$n5QMWnV_%B3*&0kIr_J$ z`7HM(+*cwDvXJhxPw1<4qk9o&kk5G5^W41Q!99}}XJLo>I+gNI Date: Wed, 4 Sep 2024 11:08:14 -0300 Subject: [PATCH 3/6] Backport Use attribute_types instead of columns_hash to determine type (#8469) Use attribute_types instead of columns_hash to determine type Previously, virtual attributes of type boolean with value `nil` would not be rendered as status tag. This also improves boolean detection in rare cases when an `attribute` declaration overrides the type detected in the database. Co-authored-by: Tilmann Singer --- lib/active_admin/view_helpers/display_helper.rb | 4 ++-- spec/unit/view_helpers/display_helper_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/active_admin/view_helpers/display_helper.rb b/lib/active_admin/view_helpers/display_helper.rb index c50bbdaa95c..ab8fac26cf1 100644 --- a/lib/active_admin/view_helpers/display_helper.rb +++ b/lib/active_admin/view_helpers/display_helper.rb @@ -108,8 +108,8 @@ def boolean_attr?(resource, attr, value) when TrueClass, FalseClass true else - if resource.class.respond_to? :columns_hash - column = resource.class.columns_hash[attr.to_s] and column.type == :boolean + if resource.class.respond_to? :attribute_types + resource.class.attribute_types[attr.to_s].is_a?(ActiveModel::Type::Boolean) end end end diff --git a/spec/unit/view_helpers/display_helper_spec.rb b/spec/unit/view_helpers/display_helper_spec.rb index 7eeb656b03a..5764fefaf44 100644 --- a/spec/unit/view_helpers/display_helper_spec.rb +++ b/spec/unit/view_helpers/display_helper_spec.rb @@ -216,6 +216,22 @@ class ThisModel expect(value.to_s).to eq "Yes\n" end + context "with non-database boolean attribute" do + let(:model_class) do + Class.new(Post) do + attribute :a_virtual_attribute, :boolean + end + end + + it "calls status_tag even when attribute is nil" do + post = model_class.new a_virtual_attribute: nil + + value = view.format_attribute post, :a_virtual_attribute + + expect(value.to_s).to eq "No\n" + end + end + it "calls status_tag for boolean non-database values" do post = Post.new post.define_singleton_method(:true_method) do From c0cff8fc1d7a2ca5c503551ba6e37c5e483f4b3c Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Wed, 4 Sep 2024 12:00:21 -0300 Subject: [PATCH 4/6] Backport Optimize count query for pagination_total: false option (#8470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Optimize count query for `pagination_total: false` option (#6911) * Remove duplicated delegation `total_pages` is listed twice. * Remove ORDER BY from count subquery Queries like `SELECT COUNT(*) FROM (SELECT DISTINCT resources.* FROM resources ORDER BY resources.created_at DESC LIMIT 1 OFFSET 30) subquery_for_count` are too inefficient * add specs about ensure count query does not include ORDER BY clause * exclude also select because based on https://github.com/activeadmin/activeadmin/pull/7489\#issuecomment-1554197081 --------- Co-authored-by: Rafael Sales Co-authored-by: David Rodríguez Co-authored-by: Matias Grunberg * fix perform_database_query_matcher: make sure to keep match truthy after the first matched query --------- Co-authored-by: David Rodríguez Co-authored-by: Rafael Sales --- .../resource_controller/decorators.rb | 2 +- .../views/components/paginated_collection.rb | 5 ++- .../perform_database_query_matcher.rb | 4 +- .../components/paginated_collection_spec.rb | 41 +++++++++++++++---- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/lib/active_admin/resource_controller/decorators.rb b/lib/active_admin/resource_controller/decorators.rb index 59243364d66..a916cb24b12 100644 --- a/lib/active_admin/resource_controller/decorators.rb +++ b/lib/active_admin/resource_controller/decorators.rb @@ -61,7 +61,7 @@ def self.wrap(decorator) def self.wrap!(parent, name) ::Class.new parent do delegate :reorder, :page, :current_page, :total_pages, :limit_value, - :total_count, :total_pages, :offset, :to_key, :group_values, + :total_count, :offset, :to_key, :group_values, :except, :find_each, :ransack, to: :object define_singleton_method(:name) { name } diff --git a/lib/active_admin/views/components/paginated_collection.rb b/lib/active_admin/views/components/paginated_collection.rb index 07128088a18..6b48d05bbde 100644 --- a/lib/active_admin/views/components/paginated_collection.rb +++ b/lib/active_admin/views/components/paginated_collection.rb @@ -103,7 +103,10 @@ def build_pagination # you pass in the :total_pages option. We issue a query to determine # if there is another page or not, but the limit/offset make this # query fast. - offset = collection.offset(collection.current_page * collection.limit_value).limit(1).count + offset_scope = collection.offset(collection.current_page * collection.limit_value) + # Support array collections. Kaminari::PaginatableArray does not respond to except + offset_scope = offset_scope.except(:select, :order) if offset_scope.respond_to?(:except) + offset = offset_scope.limit(1).count options[:total_pages] = collection.current_page + offset options[:right] = 0 end diff --git a/spec/support/matchers/perform_database_query_matcher.rb b/spec/support/matchers/perform_database_query_matcher.rb index 7fc0b79d16c..a8b289c160a 100644 --- a/spec/support/matchers/perform_database_query_matcher.rb +++ b/spec/support/matchers/perform_database_query_matcher.rb @@ -2,10 +2,12 @@ RSpec::Matchers.define :perform_database_query do |query| match do |block| + query_regexp = query.is_a?(Regexp) ? query : Regexp.new(Regexp.escape(query)) + @match = nil callback = lambda do |_name, _started, _finished, _unique_id, payload| - @match = Regexp.new(Regexp.escape(query)).match?(payload[:sql]) + @match ||= query_regexp.match?(payload[:sql]) end ActiveSupport::Notifications.subscribed(callback, "sql.active_record", &block) diff --git a/spec/unit/views/components/paginated_collection_spec.rb b/spec/unit/views/components/paginated_collection_spec.rb index f43cf9d3ee2..a5aa7aa91fe 100644 --- a/spec/unit/views/components/paginated_collection_spec.rb +++ b/spec/unit/views/components/paginated_collection_spec.rb @@ -228,16 +228,43 @@ def paginated_collection(*args) end end - it "makes no expensive COUNT queries when pagination_total is false" do - undecorated_collection = Post.all.page(1).per(30) + describe "when pagination_total is false" do + it "makes no expensive COUNT queries" do + undecorated_collection = Post.all.page(1).per(30) + + expect { paginated_collection(undecorated_collection, pagination_total: false) } + .not_to perform_database_query("SELECT COUNT(*) FROM \"posts\"") + + decorated_collection = controller_with_decorator("index", PostDecorator).apply_collection_decorator(undecorated_collection.reset) + + expect { paginated_collection(decorated_collection, pagination_total: false) } + .not_to perform_database_query("SELECT COUNT(*) FROM \"posts\"") + end + + it "makes a performant COUNT query to figure out if we are on the last page" do + # "SELECT COUNT(*) FROM (SELECT 1". Let's make sure the subquery has LIMIT and OFFSET. It shouldn't have ORDER BY + count_query = %r{SELECT COUNT\(\*\) FROM \(SELECT 1 .*FROM "posts" (?=.*OFFSET \?)(?=.*LIMIT \?)(?!.*ORDER BY)} - expect { paginated_collection(undecorated_collection, pagination_total: false) } - .not_to perform_database_query("SELECT COUNT(*) FROM \"posts\"") + undecorated_collection = Post.all.page(1).per(30) - decorated_collection = controller_with_decorator("index", PostDecorator).apply_collection_decorator(undecorated_collection) + expect { paginated_collection(undecorated_collection, pagination_total: false) } + .to perform_database_query(count_query) - expect { paginated_collection(decorated_collection, pagination_total: false) } - .not_to perform_database_query("SELECT COUNT(*) FROM \"posts\"") + undecorated_sorted_collection = undecorated_collection.reset.order(id: :desc) + + expect { paginated_collection(undecorated_sorted_collection, pagination_total: false) } + .to perform_database_query(count_query) + + decorated_collection = controller_with_decorator("index", PostDecorator).apply_collection_decorator(undecorated_collection.reset) + + expect { paginated_collection(decorated_collection, pagination_total: false) } + .to perform_database_query(count_query) + + decorated_sorted_collection = controller_with_decorator("index", PostDecorator).apply_collection_decorator(undecorated_sorted_collection.reset) + + expect { paginated_collection(decorated_sorted_collection, pagination_total: false) } + .to perform_database_query(count_query) + end end it "makes no COUNT queries to figure out the last element of each page" do From 726e7e9c95ebfaf888f29678698140d424d743d4 Mon Sep 17 00:00:00 2001 From: denisahearn Date: Wed, 4 Sep 2024 13:35:09 -0500 Subject: [PATCH 5/6] Restore inner span tag to form inputs legend (#8467) --- lib/active_admin/views/components/active_admin_form.rb | 2 +- spec/unit/form_builder_spec.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/active_admin/views/components/active_admin_form.rb b/lib/active_admin/views/components/active_admin_form.rb index 82c2d3edf99..0c17a8c93ac 100644 --- a/lib/active_admin/views/components/active_admin_form.rb +++ b/lib/active_admin/views/components/active_admin_form.rb @@ -127,7 +127,7 @@ def build(form_builder, *args, &block) html_options[:class] ||= "inputs" legend = args.shift if args.first.is_a?(::String) legend = html_options.delete(:name) if html_options.key?(:name) - legend_tag = legend ? helpers.tag.legend(legend, class: "fieldset-title") : "" + legend_tag = legend ? helpers.tag.legend(helpers.tag.span(legend), class: "fieldset-title") : "" fieldset_attrs = tag_attributes html_options @opening_tag = "
#{legend_tag}
    " @closing_tag = "
" diff --git a/spec/unit/form_builder_spec.rb b/spec/unit/form_builder_spec.rb index fe3bc97545c..eba404e7685 100644 --- a/spec/unit/form_builder_spec.rb +++ b/spec/unit/form_builder_spec.rb @@ -84,12 +84,16 @@ def build_form(options = {}, form_object = Post.new, &block) it "should use the rails helper for rendering attributes" do expect(body).to have_css("fieldset[data-test='custom']") end + + it "should generate a legend with an inner span containing the name" do + expect(body).to have_selector("fieldset legend span", text: "custom_name") + end end context "with XSS payload as name" do let :body do build_form do |f| - f.inputs name: '' do + f.inputs name: "" do f.input :title f.input :body end From c16c6ee3492475b601b15f83f8bcde8216cec29b Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Thu, 5 Sep 2024 17:29:04 -0300 Subject: [PATCH 6/6] Get ready for 3.2.5 Release (#8473) Get ready for 3.2.5 release --- CHANGELOG.md | 17 +++++++++++++++++ Gemfile.lock | 2 +- gemfiles/rails_61/Gemfile.lock | 2 +- gemfiles/rails_70/Gemfile.lock | 2 +- gemfiles/rails_71/Gemfile.lock | 2 +- lib/active_admin/version.rb | 2 +- package.json | 2 +- 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bae681f4064..d7c3c94246b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ ## Unreleased +## 3.2.5 [☰](https://github.com/activeadmin/activeadmin/compare/v3.2.4..v3.2.5) + +### Enhancements + +* Backport Add favicon to template app to fix Rails 7.2 test suite run [#8468] by [@mgrunberg] +* Backport Use attribute_types instead of columns_hash to determine type [#8469] by [@mgrunberg] +* Backport Optimize count query for pagination_total: false option [#8470] by [@mgrunberg] + +### Bug Fixes + +* Restore inner span tag to form inputs legend [#8467] by [@denisahearn] + ## 3.2.4 [☰](https://github.com/activeadmin/activeadmin/compare/v3.2.3..v3.2.4) ### Enhancements @@ -944,6 +956,10 @@ Please check [0-6-stable] for previous changes. [#8412]: https://github.com/activeadmin/activeadmin/pull/8412 [#8434]: https://github.com/activeadmin/activeadmin/pull/8434 [#8446]: https://github.com/activeadmin/activeadmin/pull/8446 +[#8467]: https://github.com/activeadmin/activeadmin/pull/8467 +[#8468]: https://github.com/activeadmin/activeadmin/pull/8468 +[#8469]: https://github.com/activeadmin/activeadmin/pull/8469 +[#8470]: https://github.com/activeadmin/activeadmin/pull/8470 [@1000ship]: https://github.com/1000ship [@5t111111]: https://github.com/5t111111 @@ -972,6 +988,7 @@ Please check [0-6-stable] for previous changes. [@craigmcnamara]: https://github.com/craigmcnamara [@DanielHeath]: https://github.com/DanielHeath [@deivid-rodriguez]: https://github.com/deivid-rodriguez +[@denisahearn]: https://github.com/denisahearn [@dennisvdvliet]: https://github.com/dennisvdvliet [@dhyegofernando]: https://github.com/dhyegofernando [@dkniffin]: https://github.com/dkniffin diff --git a/Gemfile.lock b/Gemfile.lock index d5f509cbab0..0031de9fa10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - activeadmin (3.2.4) + activeadmin (3.2.5) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/gemfiles/rails_61/Gemfile.lock b/gemfiles/rails_61/Gemfile.lock index e4313962764..43e663103e9 100644 --- a/gemfiles/rails_61/Gemfile.lock +++ b/gemfiles/rails_61/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - activeadmin (3.2.4) + activeadmin (3.2.5) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/gemfiles/rails_70/Gemfile.lock b/gemfiles/rails_70/Gemfile.lock index 140fd3cd580..22a2821458e 100644 --- a/gemfiles/rails_70/Gemfile.lock +++ b/gemfiles/rails_70/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - activeadmin (3.2.4) + activeadmin (3.2.5) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/gemfiles/rails_71/Gemfile.lock b/gemfiles/rails_71/Gemfile.lock index 4953221b670..491378f7872 100644 --- a/gemfiles/rails_71/Gemfile.lock +++ b/gemfiles/rails_71/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - activeadmin (3.2.4) + activeadmin (3.2.5) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/lib/active_admin/version.rb b/lib/active_admin/version.rb index 1addf212421..9055a218fb9 100644 --- a/lib/active_admin/version.rb +++ b/lib/active_admin/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module ActiveAdmin - VERSION = "3.2.4" + VERSION = "3.2.5" end diff --git a/package.json b/package.json index 31f83d03c96..f91bd4af0dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@activeadmin/activeadmin", - "version": "3.2.4", + "version": "3.2.5", "description": "The administration framework for Ruby on Rails.", "main": "app/assets/javascripts/active_admin/base.js", "type": "module",