From b2eeae3190db0db891ca2fa8c3b1c2c1a5bf2105 Mon Sep 17 00:00:00 2001 From: Igor Fedoronchuk Date: Thu, 1 Oct 2026 12:55:33 +0200 Subject: [PATCH] Cover Rails 8.1 The matrix stopped at 8.0. Adding 8.1 fails before any example runs: NameError: undefined local variable or method `stale_when_importmap_changes' for class ApplicationController rails new on 8.1 emits that macro into the generated ApplicationController. It comes from importmap-rails, and this dummy app runs on Sprockets because that is what Active Admin 3 needs, so the gem is absent and the app raises at boot. Sprockets is not the problem; the generated scaffold assuming importmap is. Skip JavaScript during generation so the macro never appears. The sibling active_admin_import uses the same fix, with the caveat that its specs run on rack_test. This suite drives real Chrome, so the relevant question is whether anything the specs need goes missing: it does not, because app/assets/javascripts/active_admin.js comes from active_admin:install rather than from rails new. Confirmed green on 7.1, 8.0 and 8.1. Active Admin 3.2 is excluded on 8.1 for the reason it is already excluded on 8.0: it predates Rails 8 support. --- .github/workflows/ci.yml | 5 ++++- tasks/test.rake | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e211bee..cfee892 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,11 +15,14 @@ jobs: fail-fast: false matrix: ruby: ['3.2', '3.3', '3.4'] - rails: ['7.1.0', '7.2.0', '8.0.0'] + rails: ['7.1.0', '7.2.0', '8.0.0', '8.1.0'] activeadmin: ['3.2.0', '3.5.0'] exclude: + # Active Admin 3.2 predates Rails 8 support. - rails: '8.0.0' activeadmin: '3.2.0' + - rails: '8.1.0' + activeadmin: '3.2.0' env: RAILS: ${{ matrix.rails }} AA: ${{ matrix.activeadmin }} diff --git a/tasks/test.rake b/tasks/test.rake index e7d8dab..f35287e 100644 --- a/tasks/test.rake +++ b/tasks/test.rake @@ -2,7 +2,14 @@ desc 'Creates a test rails app for the specs to run against' task :setup do require 'rails/version' + # Rails 8.1 wires importmap-rails into the generated ApplicationController + # (stale_when_importmap_changes). This app runs on Sprockets, so that gem is + # absent and the controller raises NameError at boot, before any example. + # Skipping JavaScript stops the macro being generated; the Active Admin + # bundle the specs exercise comes from active_admin:install, not from + # rails new, so nothing the suite needs goes with it. rails_new_args = %w[ + --skip-javascript --skip-turbolinks --skip-spring --skip-bootsnap