Skip to content

Commit

Permalink
Merge pull request #66 from amatsuda/lazy_load_action_mailer
Browse files Browse the repository at this point in the history
Lazy-load ActionMailer::Base to defer :action_mailer on_load hook
  • Loading branch information
pseudomuto authored Dec 21, 2017
2 parents 6ca29c6 + 3fdcb96 commit 4a11fe3
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 @@ -8,11 +8,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 4a11fe3

Please sign in to comment.