aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-24 05:57:40 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-24 06:01:25 +0900
commit6003dafc1f844275d6a7fe9e626eaeb1176c8e8a (patch)
treec088b49f15381d527e59b998f3f44206957c363d /actionmailer/lib
parentd25c2e7c4c88440154087a08fa79ba0bf3038ba3 (diff)
parentfbb2fc8aa7d17fd86ad9c3fbbe60ef84a4cde950 (diff)
downloadrails-6003dafc1f844275d6a7fe9e626eaeb1176c8e8a.tar.gz
rails-6003dafc1f844275d6a7fe9e626eaeb1176c8e8a.tar.bz2
rails-6003dafc1f844275d6a7fe9e626eaeb1176c8e8a.zip
Merge pull request #30391 from jbourassa/fix-actionmailer-lambda-default
Fix actionmailer lambda default
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index eb8ae59533..3af95081ee 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -889,7 +889,7 @@ module ActionMailer
default_values = self.class.default.map do |key, value|
[
key,
- value.is_a?(Proc) ? instance_exec(&value) : value
+ compute_default(value)
]
end.to_h
@@ -898,6 +898,16 @@ module ActionMailer
headers_with_defaults
end
+ def compute_default(value)
+ return value unless value.is_a?(Proc)
+
+ if value.arity == 1
+ instance_exec(self, &value)
+ else
+ instance_exec(&value)
+ end
+ end
+
def assign_headers_to_message(message, headers)
assignable = headers.except(:parts_order, :content_type, :body, :template_name,
:template_path, :delivery_method, :delivery_method_options)