mad_mimi_mailer 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mad_mimi_mailable.rb +7 -3
- data/lib/mad_mimi_mailer.rb +1 -1
- metadata +2 -2
data/lib/mad_mimi_mailable.rb
CHANGED
|
@@ -40,7 +40,7 @@ module MadMimiMailable
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
module ClassMethods
|
|
43
|
-
attr_accessor :method_prefix
|
|
43
|
+
attr_accessor :method_prefix, :use_erb
|
|
44
44
|
|
|
45
45
|
def method_missing(method_symbol, *parameters)
|
|
46
46
|
if method_prefix && method_symbol.id2name.match(/^deliver_(#{method_prefix}_[_a-z]\w*)/)
|
|
@@ -56,7 +56,7 @@ module MadMimiMailable
|
|
|
56
56
|
mail = new
|
|
57
57
|
mail.__send__(method, *parameters)
|
|
58
58
|
|
|
59
|
-
if mail
|
|
59
|
+
if use_erb?(mail)
|
|
60
60
|
mail.create!(method, *parameters)
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -90,7 +90,7 @@ module MadMimiMailable
|
|
|
90
90
|
|
|
91
91
|
params['unconfirmed'] = '1' if mail.unconfirmed
|
|
92
92
|
|
|
93
|
-
if mail
|
|
93
|
+
if use_erb?(mail)
|
|
94
94
|
if mail.parts.any?
|
|
95
95
|
params['raw_plain_text'] = content_for(mail, "text/plain")
|
|
96
96
|
params['raw_html'] = content_for(mail, "text/html") { |html| validate(html.body) }
|
|
@@ -154,6 +154,10 @@ module MadMimiMailable
|
|
|
154
154
|
raise "Please provide a String or an Array for recipients or bcc."
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
|
+
|
|
158
|
+
def use_erb?(mail)
|
|
159
|
+
mail.use_erb || use_erb
|
|
160
|
+
end
|
|
157
161
|
end
|
|
158
162
|
|
|
159
163
|
end
|
data/lib/mad_mimi_mailer.rb
CHANGED