diff options
author | George Claghorn <george@basecamp.com> | 2019-02-18 11:50:50 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2019-02-18 11:50:50 -0500 |
commit | ef602f8892fa4c41d7b0bb7868fc9084a9888212 (patch) | |
tree | ad2a86c1bae8a4c9a215a49eea21414243d36201 /actionmailbox | |
parent | 4ea067017ae52d4a74335ed85df085a86663d213 (diff) | |
download | rails-ef602f8892fa4c41d7b0bb7868fc9084a9888212.tar.gz rails-ef602f8892fa4c41d7b0bb7868fc9084a9888212.tar.bz2 rails-ef602f8892fa4c41d7b0bb7868fc9084a9888212.zip |
Fix preparing the configured Action Mailbox ingress in production
When reloading is disabled, after_initialize hooks run after to_prepare hooks have already run for the last time. Since to_prepare hooks always run after application initializers, we don't need need to use an after_initialize hook.
Diffstat (limited to 'actionmailbox')
-rw-r--r-- | actionmailbox/lib/action_mailbox/engine.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/actionmailbox/lib/action_mailbox/engine.rb b/actionmailbox/lib/action_mailbox/engine.rb index 27334c037e..039f04ac2f 100644 --- a/actionmailbox/lib/action_mailbox/engine.rb +++ b/actionmailbox/lib/action_mailbox/engine.rb @@ -29,13 +29,11 @@ module ActionMailbox end end - initializer "action_mailbox.ingress" do - config.after_initialize do |app| + initializer "action_mailbox.ingress" do |app| + config.to_prepare do if ActionMailbox.ingress = app.config.action_mailbox.ingress.presence - config.to_prepare do - if ingress_controller_class = "ActionMailbox::Ingresses::#{ActionMailbox.ingress.to_s.classify}::InboundEmailsController".safe_constantize - ingress_controller_class.prepare - end + if ingress_controller_class = "ActionMailbox::Ingresses::#{ActionMailbox.ingress.to_s.classify}::InboundEmailsController".safe_constantize + ingress_controller_class.prepare end end end |