From 4b65e5058e726af9ae02e2e0a65e6b5e1a1628ec Mon Sep 17 00:00:00 2001 From: hnatt Date: Thu, 29 Oct 2015 21:58:27 +0200 Subject: Refactor out headers to message assignment from ActionMailer::Base#mail --- actionmailer/lib/action_mailer/base.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'actionmailer/lib/action_mailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index d0d3c21a15..a90279d578 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -808,9 +808,7 @@ module ActionMailer # Set configure delivery behavior wrap_delivery_behavior!(headers.delete(:delivery_method), headers.delete(:delivery_method_options)) - # Assign all headers except parts_order, content_type, body, template_name, and template_path - assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path) - assignable.each { |k, v| message[k] = v } + assign_headers_to_message(headers) # Render the templates and blocks responses = collect_responses(headers, &block) @@ -844,6 +842,11 @@ module ActionMailer end private :apply_defaults + def assign_headers_to_message(headers) + assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path) + assignable.each { |k, v| message[k] = v } + end + protected # Used by #mail to set the content type of the message. -- cgit v1.2.3