aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r--actionmailer/lib/action_mailer/base.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index ef3820ad67..0519783d02 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -1,6 +1,7 @@
require 'mail'
require 'action_mailer/tmail_compat'
require 'action_mailer/collector'
+require 'active_support/core_ext/array/wrap'
module ActionMailer #:nodoc:
# Action Mailer allows you to send email from your application using a mailer model and views.
@@ -590,7 +591,7 @@ module ActionMailer #:nodoc:
responses, parts_order = [], nil
if block_given?
- collector = ActionMailer::Collector.new(self) { render(action_name) }
+ collector = ActionMailer::Collector.new(lookup_context) { render(action_name) }
yield(collector)
parts_order = collector.responses.map { |r| r[:content_type] }
responses = collector.responses
@@ -604,8 +605,10 @@ module ActionMailer #:nodoc:
templates_name = headers.delete(:template_name) || action_name
each_template(templates_path, templates_name) do |template|
+ self.formats = template.formats
+
responses << {
- :body => render(:_template => template),
+ :body => render(:template => template),
:content_type => template.mime_type.to_s
}
end
@@ -615,7 +618,7 @@ module ActionMailer #:nodoc:
end
def each_template(paths, name, &block) #:nodoc:
- Array(paths).each do |path|
+ Array.wrap(paths).each do |path|
templates = lookup_context.find_all(name, path)
templates = templates.uniq_by { |t| t.formats }