effective_email_templates 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b61c8d36a7412e96eef80c03fb75480a8da1de2156b67587d7fb88b24e85e7bd
|
4
|
+
data.tar.gz: dca4e0ccafebf84a7b19f78797854fbb98d1547e18d7a593b408f69ef6e3658c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65426e9861152f2794e2817f70983fed0c9c918f3c24fd819f92aa1353fc28d122c4573b0c4e68ce8953d7dcb7ff5de170d38b6eab6969c71d77fa0ad6b0d75c
|
7
|
+
data.tar.gz: 9754add70dac2088baf9ee4c8b2fdb4e9f3f290043db9a9af358c323655e4f11d7f6aa0073506f4fe11b421c6f04fc650dd31ce58175d298cd1cbeb7664b4d57
|
@@ -9,21 +9,26 @@ module EffectiveEmailTemplatesMailer
|
|
9
9
|
|
10
10
|
assigns = (@assigns || {})
|
11
11
|
|
12
|
-
# Parse
|
12
|
+
# Parse body content if given
|
13
13
|
body = assigns.delete(:body) || headers[:body] || headers['body']
|
14
14
|
email_template.body = body if body.present?
|
15
15
|
|
16
|
-
#
|
16
|
+
# Parse subject content if explicitly given
|
17
|
+
# Otherwise the :subject key is a default and should be ignored in favor of the email template subject instead
|
17
18
|
subject = assigns.delete(:subject)
|
19
|
+
subject ||= (headers[:subject] || headers['subject']) if (headers[:custom_subject] || headers['custom_subject'])
|
18
20
|
email_template.subject = subject if subject.present?
|
19
21
|
|
20
22
|
# Add any _url helpers
|
21
23
|
assigns = route_url_assigns(email_template, assigns).merge(assigns)
|
22
24
|
|
23
|
-
# Render from the template, possibly with updated body
|
25
|
+
# Render from the template, possibly with updated body and subject
|
24
26
|
rendered = email_template.render(assigns)
|
25
27
|
|
26
|
-
|
28
|
+
# Merge any other passed values
|
29
|
+
merged = rendered.merge(headers.except(:body, :subject, :custom_subject, 'body', 'subject', 'custom_subject'))
|
30
|
+
|
31
|
+
super(merged)
|
27
32
|
end
|
28
33
|
|
29
34
|
private
|