Skip to content

Commit

Permalink
Lazy-load ActionMailer::Base to defer :action_mailer on_load hook
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed May 12, 2017
1 parent 9664fbf commit 3fdcb96
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/letter_opener_web/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ class Engine < ::Rails::Engine
isolate_namespace LetterOpenerWeb

initializer 'letter_opener_web.add_delivery_method' do
ActionMailer::Base.add_delivery_method(
:letter_opener_web,
LetterOpenerWeb::DeliveryMethod,
location: LetterOpenerWeb.config.letters_location
)
ActiveSupport.on_load :action_mailer do
ActionMailer::Base.add_delivery_method(
:letter_opener_web,
LetterOpenerWeb::DeliveryMethod,
location: LetterOpenerWeb.config.letters_location
)
end
end

initializer 'assets' do |_app|
Expand Down

0 comments on commit 3fdcb96

Please sign in to comment.