Skip to content

fix: register IndexAsCalendar 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: register IndexAsCalendar 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 application's 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 hit:

NameError: uninitialized constant ActiveAdmin::Views::IndexAsCalendar

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 require the view component. The Engine class is kept (empty) so Propshaft / AA 4 can still discover app/assets/stylesheets/activeadmin_calendar.css.

`config.to_prepare` fires after the application's 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 hit:

  NameError: uninitialized constant ActiveAdmin::Views::IndexAsCalendar

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 require the
view component. The Engine class is kept (empty) so Propshaft / AA 4
can still discover `app/assets/stylesheets/activeadmin_calendar.css`.
@Fivell Fivell merged commit 890e7bf 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