GeezerVison is showing github.com — Build route helpers from the route set ActiveAdmin.routes draws into by senid231 · Pull Request #9154 · activeadmin/activeadmin
Conversation
senid231
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Active Admin now builds its route helpers from the route set that ActiveAdmin.routes(self) is called in, so it works inside an engine's routes.draw. Until now, apps patched Helpers::Routes, BaseController and the Devise controllers to get there (#4294).
Decisions the diff doesn't show:
ActionDispatch::Routing::Mapper has no public reader for its route set in Rails 7.2 to 8.1, so Application#routes reads @set, falling back to the host routes. A spec fails if that breaks.
BaseController.inherited adds the engine's helpers to resource and page controllers. If controllers were loaded for another route set, ActiveAdmin.routes reloads them, so only one route set can host Active Admin. In an engine app on Rails 7.2 and 8.1, the engine's routes trigger the first load, so Active Admin and its before_load and after_load hooks still run once. A second load happens only if something loads Active Admin earlier, such as calling ActiveAdmin.routes in both the host and the engine.
- The Devise views use Devise's own path helpers, so they follow
router_name. With router_name, Devise looks up root_path on that route set after sign-out, so Active Admin returns its own root there. An app's after_sign_out_path_for still wins. Apps with router_name: :main_app now sign out to the admin root, as apps without it already did.
- In engine mode, host-app helpers need
main_app.. The docs say so.
Part of #9147. Request specs mount an engine at /backoffice and cover pages, sign-in and sign-out.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.12%. Comparing base (e1dad93) to head (a58d1f5).
Additional details and impacted files
@@ Coverage Diff @@
## master #9154 +/- ##
=======================================
Coverage 99.11% 99.12%
=======================================
Files 139 139
Lines 4071 4092 +21
=======================================
+ Hits 4035 4056 +21
Misses 36 36
☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Codecov's missing line was the super branch of Helpers::Routes.method_missing. spec/unit/helpers/routes_spec.rb now covers it, and also respond_to? and default_url_options.
A review pass also found two bugs in the sign-out override, both now fixed with specs:
- It ran ahead of
ApplicationController, so an app's own after_sign_out_path_for was ignored. It now applies only when Devise's default would run.
- A controller subclass that overrides the method and calls
super skipped the engine root. The override now looks up the next method from its own module.
The docs now say that host-app route helpers need main_app. when Active Admin runs from an engine.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Route helpers always came from Rails.application.routes, so an app that
calls ActiveAdmin.routes inside an engine's routes.draw had to include
the engine's url_helpers into ActiveAdmin internals (activeadmin#4294). Devise
lookups go through router_name, so the Devise views use Devise's path
helpers and sign-out uses ActiveAdmin's root_path.
Co-Authored-By: Clanker
ActiveAdmin's sign-out override sat ahead of ApplicationController and
ignored an app's own redirect. It now applies only when Devise's default
would run.
Co-Authored-By: Clanker
A subclass that overrides after_sign_out_path_for and calls super made
method() resolve to the subclass, so the engine root was skipped. The
docs now say host-app helpers need main_app in the engine setup.
Co-Authored-By: Clanker
The spec drew routes for a temporary application and left them in place,
so a later spec that expected the admin routes could fail.
Co-Authored-By: Clanker
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|