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/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 ba7554882c6..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) @@ -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..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) @@ -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..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) @@ -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..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) @@ -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/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/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/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/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/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/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", 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/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 00000000000..db016de0d55 Binary files /dev/null and b/spec/support/templates/public/favicon.ico differ 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 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 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 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