Skip to content

Added support of Active Admin v4 - #219

Merged
Fivell merged 3 commits into
activeadmin-plugins:masterfrom
blurvene:active-admin-v4-support
Jun 1, 2026
Merged

Added support of Active Admin v4#219
Fivell merged 3 commits into
activeadmin-plugins:masterfrom
blurvene:active-admin-v4-support

Conversation

@blurvene

@blurvene blurvene commented Jun 1, 2026

Copy link
Copy Markdown

Summary

Adds support for ActiveAdmin 4 (tested against 4.0.0.beta22) alongside the existing AA 3 support. The gem stays a pure-Ruby dependency — active_admin_import gains no Node/npm dependency, and neither does its test suite: Tailwind asset compilation is owned entirely by ActiveAdmin in host apps.

The dependency range widens to >= 3.0, < 4.1 and the test matrix gains AA 4 cells (SQLite + PostgreSQL).

Why

ActiveAdmin 4 moves from Sprockets/Sass to Tailwind + importmap and ships Formtastic 6. Two things needed to change for the import flow to work under AA 4 while staying compatible with AA 3:

  1. Flash type. AA 4's flash partial only renders error / alert / notice — a flash[:warning] is silently dropped (see _flash_messages.html.erb). The empty-file message picks the key by AA version: :alert on AA 4, :warning on AA 3 — so AA 3 behavior is unchanged and AA 4 renders correctly.
  2. Action-item styling hook. AA 4's built-in action_item links carry a Tailwind class. The import link now accepts HTML options so it can match.

Changes

Library

  • lib/active_admin_import/dsl.rb — empty-file message uses flash[:alert] on AA 4 and flash[:warning] on AA 3 (no behavior change for AA 3). The index "Import …" action_item link now forwards :action_item_html_options to link_to.
  • lib/active_admin_import/options.rb — new :action_item_html_options option, defaulting to { class: 'action-item-button' } (the class AA 4 hardcodes for its action items; a no-op on AA 3).
  • README.md — documents the new :action_item_html_options option in the options table.

Dependency

  • active_admin_import.gemspec — widens activeadmin from >= 3.0, < 4.0 to >= 3.0, < 4.1.
    • The cap matches the tested ceiling (4.0.0.beta22). Bumping it to admit AA 4.1+ should come with a matching CI cell for that release.

CI / test harness

  • .github/workflows/test.yml — adds AA 4.0.0.beta22 matrix rows (Rails 7.2 / 8.0), plus a dedicated PostgreSQL 16 + AA 4 job. No Node setup needed.
  • Gemfile — on AA 4, loads cssbundling-rails + importmap-rails instead of sprockets-rails + sass-rails (Tailwind v4 conflicts with sass-rails); pins AA prerelease versions exactly so each CI cell tests the build it claims to.
  • spec/support/rails_template.rb — on AA 4, runs active_admin:assets (swaps the Sprockets SCSS/JS for AA 4's Tailwind CSS stub). No Tailwind compile: the specs assert on DOM structure and flash text, not visual styling, so an unstyled stub suffices and the suite stays Node-free.
  • tasks/test.rake / spec/spec_helper.rb / spec/support/test_app_paths.rb (new) — skip the asset pipeline when generating the AA 4 test app, and key the cached app on the AA version via a shared helper (rails-<rails>-<db>-aa<aa>) so AA 3 and AA 4 apps — which generate structurally different apps — no longer collide in one cache slot.
  • spec/support/import_form_selectors.rb (new) — centralizes the import-form DOM selectors so specs are not littered with literal IDs; AA 3 and AA 4 share the same selectors today.
  • spec/import_spec.rb — specs reference the shared selectors instead of inline strings.
  • Gemfile / spec/spec_helper.rb — removes the unused cuprite + webrick test dependencies and pins Capybara to its rack_test driver explicitly. No spec uses a JavaScript / real-browser driver (none are tagged js: true), so the suite needs neither Chrome nor a running app server.

Test plan

  • Full spec suite green on AA 3 (SQLite).
  • AA 4.0.0.beta22 matrix cells green (Rails 7.2 / 8.0, SQLite).
  • AA 4.0.0.beta22 + PostgreSQL 16 job green.
  • Existing MySQL / PostgreSQL AA 3 jobs unaffected.

Follow-up

  • Re-test against ActiveAdmin 4.0 GA when released and bump the < 4.1 cap (with a matching CI cell).
  • Tailwind styling polish for the import view under AA 4 — out of scope here; the specs are style-agnostic, but a host app would want the compiled CSS.
  • Optional CI cleanup: collapse the AA 3 and AA 4 PostgreSQL jobs into a single AA-matrixed PostgreSQL job to cut duplication.
  • Version bump intentionally left to the maintainer (no version.rb change in this MR).
Comment thread lib/active_admin_import/dsl.rb Outdated
Comment thread active_admin_import.gemspec Outdated
@blurvene
blurvene requested a review from Fivell June 1, 2026 13:30
@Fivell
Fivell merged commit 0167de5 into activeadmin-plugins:master Jun 1, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants