diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-01-30 13:02:30 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-01-30 13:02:30 -0500 |
commit | 58f9c4f096c92518a81093aa9912314b14873a66 (patch) | |
tree | 3d63c815ff1dc1ce834cb99342ba16b599ea4e39 | |
parent | 04b59ec930a0e88352b6acda493e44069c9a9686 (diff) | |
download | rails-58f9c4f096c92518a81093aa9912314b14873a66.tar.gz rails-58f9c4f096c92518a81093aa9912314b14873a66.tar.bz2 rails-58f9c4f096c92518a81093aa9912314b14873a66.zip |
Override the initializers instead of using tap
We own the class so we can override the initialize.
-rw-r--r-- | actionmailer/lib/action_mailer/parameterized.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/parameterized.rb b/actionmailer/lib/action_mailer/parameterized.rb index 4cb355a4ed..20a0968607 100644 --- a/actionmailer/lib/action_mailer/parameterized.rb +++ b/actionmailer/lib/action_mailer/parameterized.rb @@ -105,7 +105,7 @@ module ActionMailer def method_missing(method_name, *args) if @mailer.action_methods.include?(method_name.to_s) - ActionMailer::Parameterized::MessageDelivery.new(@mailer, method_name, *args).tap { |pmd| pmd.params = @params } + ActionMailer::Parameterized::MessageDelivery.new(@mailer, method_name, @params, *args) else super end @@ -113,12 +113,15 @@ module ActionMailer end class MessageDelivery < ActionMailer::MessageDelivery # :nodoc: - attr_accessor :params + def initialize(mailer_class, action, params, *args) + super(mailer_class, action, *args) + @params = params + end private def processed_mailer @processed_mailer ||= @mailer_class.new.tap do |mailer| - mailer.params = params + mailer.params = @params mailer.process @action, *@args end end |