GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@senid231 senid231 commented Nov 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@codecov

codecov Bot commented Nov 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@senid231 senid231 mentioned this pull request Nov 4, 2026
Theme 4.0 for ActiveAdmin 4 activeadmin-plugins/active_admin_theme#78
Draft
17 of 22 tasks
@senid231

senid231 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

senid231 added 3 commits November 12, 2026 13:20
@senid231
Build route helpers from the route set ActiveAdmin.routes draws into
bec8dd8
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
@senid231
Keep an app's after_sign_out_path_for and cover Helpers::Routes
cd80e57
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
@senid231
Find the sign-out fallback from ActiveAdmin's own method
30f4c3e
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
@senid231
senid231 force-pushed the route-helpers-engine branch from 5b5d26d to 30f4c3e Compare November 12, 2026 11:20
senid231 added 2 commits November 12, 2026 14:01
@senid231
Reload routes after the default namespace spec restores the app
5ca5fcb
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
@senid231
Separate route_set from initialize with a blank line
a58d1f5
Co-Authored-By: Clanker

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

1 participant

@senid231
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.