Our application depends on two gems: GitHub - dxw/mail-notify: ActionMailer support for the GOV.UK Notify API and GitHub - collectiveidea/audited: Audited (formerly acts_as_audited) is an ORM extension that logs all changes to your Rails models..
The mailer preview index at
rails/mailers is broken. It throws
ActionView::Template::Error (arguments passed to url_for can't be handled. Please require routes or provide your own implementation). This seems to be because the definition of
url_for comes from
ActionView::Helpers::UrlHelper. Removing the
audited gem makes the preview index work correctly, because
url_for then resolves to
Here is a minimal rails app displaying the behaviour: GitHub - duncanjbrown/audited-bug.
I can make the exception go away by editing these lines of the audited gem in one of two ways.
- I can wrap them in a Railtie under an
initializerlike this: Wrap the ActiveSupport.on_load hook in a railtie · duncanjbrown/audited@fa11351 · GitHub
- I can comment out the reference to
I would like to understand a few things.
- Why does this happen?
- What has
ActionController::APIgot to do with it?
- Why does it manifest in the way it does (the
- Is it ever right to set an
ActiveSupport.on_loadhook outside an initializer (ie is this a mistake in
Thanks for your help!