lib/action_mailer/base.rb in actionmailer-6.0.0.beta3 vs lib/action_mailer/base.rb in actionmailer-6.0.0.rc1

- old
+ new

@@ -942,13 +942,13 @@ assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path, :delivery_method, :delivery_method_options) assignable.each { |k, v| message[k] = v } end - def collect_responses(headers) + def collect_responses(headers, &block) if block_given? - collect_responses_from_block(headers, &Proc.new) + collect_responses_from_block(headers, &block) elsif headers[:body] collect_responses_from_text(headers) else collect_responses_from_templates(headers) end @@ -971,13 +971,13 @@ def collect_responses_from_templates(headers) templates_path = headers[:template_path] || self.class.mailer_name templates_name = headers[:template_name] || action_name each_template(Array(templates_path), templates_name).map do |template| - self.formats = [template.format] + format = template.format || self.formats.first { - body: render(template: template), - content_type: template.type.to_s + body: render(template: template, formats: [format]), + content_type: Mime[format].to_s } end end def each_template(paths, name, &block)