RGJ
(Richard - Communiteq)
September 2, 2026, 3:47pm
494
Hmm does that actually work? In my experience touching Plugin::Instance after initialize doesn’t go well.
pmusaraj
(Penar Musaraj)
September 2, 2026, 4:38pm
495
It does, we use it in several places inside after_initialize, for example:
Guardian.prepend Chat::GuardianExtensions
UserNotifications.prepend Chat::UserNotificationsExtension
Notifications::ConsolidationPlan.prepend Chat::NotificationConsolidationExtension
UserOption.prepend Chat::UserOptionExtension
Category.prepend Chat::CategoryExtension
Reviewable.prepend Chat::ReviewableExtension
Bookmark.prepend Chat::BookmarkExtension
Upload.prepend Chat::UploadExtension
User.prepend Chat::UserExtension
Group.prepend Chat::GroupExtension
Plugin::Instance.prepend Chat::PluginInstanceExtension
Jobs::ExportCsvFile.prepend Chat::MessagesExporter
WebHook.prepend Chat::OutgoingWebHookExtension
end
Oneboxer.register_local_handler("chat/chat") do |url, route|
Chat::OneboxHandler.handle(url, route)
end
InlineOneboxer.register_local_handler("chat/chat") do |url, route|
Chat::InlineOneboxHandler.handle(url, route)
The main issue is that other plugins or core cannot access the prepended method. In this case, the method is only accessed by the same plugin, later in the lifecycle.
1 Like