Skip to content

fix: prepend view extensions at gem-require time, not via to_prepare#1

Merged
Fivell merged 1 commit into
masterfrom
fix/load-order-before-to-prepare
May 21, 2026
Merged

fix: prepend view extensions at gem-require time, not via to_prepare#1
Fivell merged 1 commit into
masterfrom
fix/load-order-before-to-prepare

Conversation

@Fivell
Copy link
Copy Markdown
Member

@Fivell Fivell commented May 21, 2026

config.to_prepare fires after the applications initializers, which is too late for consuming engines that require AA resource files from an initializer (a pattern AA permits via config.load_paths). Those resources see footer_data: silently no-op and the tfoot row never renders (or NameError when references to TableForExtension appear at registration time).

Adopt the pattern used by sibling AA plugins (active_admin_sidebar, etc.): require "activeadmin" at the top of the gem's main file so ActiveAdmin::Views is guaranteed to exist, then eagerly prepend the extensions onto TableFor and IndexAsTable. The Engine class is kept (empty) so Rails still treats the gem as an engine on boot.

`config.to_prepare` fires after the applications initializers, which
is too late for consuming engines that require AA resource files
from an initializer (a pattern AA permits via `config.load_paths`).
Those resources see footer_data: silently no-op and the tfoot row
never renders (or NameError when references to TableForExtension
appear at registration time).

Adopt the pattern used by sibling AA plugins (active_admin_sidebar,
etc.): require "activeadmin" at the top of the gem's main file so
`ActiveAdmin::Views` is guaranteed to exist, then eagerly prepend the
extensions onto `TableFor` and `IndexAsTable`. The Engine class is
kept (empty) so Rails still treats the gem as an engine on boot.
@Fivell Fivell merged commit c04be9f into master May 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant