aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorhnatt <hnatt88@gmail.com>2015-10-29 21:55:14 +0200
committerhnatt <hnatt88@gmail.com>2015-10-29 21:55:14 +0200
commit79b6a4bbc4d8a209363c33df79caeea462f6dde6 (patch)
tree863c0bf331c0ca426c990f2bcfc08a2c602451a4 /actionmailer/lib
parent04f1ce7950cb75407eff10bad6df6aa6414df197 (diff)
downloadrails-79b6a4bbc4d8a209363c33df79caeea462f6dde6.tar.gz
rails-79b6a4bbc4d8a209363c33df79caeea462f6dde6.tar.bz2
rails-79b6a4bbc4d8a209363c33df79caeea462f6dde6.zip
Use attr_internal in ActionMailer::Base#mail instead of local var for message
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 320e9740e7..d0d3c21a15 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -797,39 +797,37 @@ module ActionMailer
def mail(headers = {}, &block)
return @_message if @_mail_was_called && headers.blank? && !block
- m = @_message
-
# At the beginning, do not consider class default for content_type
content_type = headers[:content_type]
headers = apply_defaults(headers)
# Apply charset at the beginning so all fields are properly quoted
- m.charset = charset = headers[:charset]
+ message.charset = charset = headers[:charset]
# 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| m[k] = v }
+ assignable.each { |k, v| message[k] = v }
# Render the templates and blocks
responses = collect_responses(headers, &block)
@_mail_was_called = true
- create_parts_from_responses(m, responses)
+ create_parts_from_responses(message, responses)
# Setup content type, reapply charset and handle parts order
- m.content_type = set_content_type(m, content_type, headers[:content_type])
- m.charset = charset
+ message.content_type = set_content_type(message, content_type, headers[:content_type])
+ message.charset = charset
- if m.multipart?
- m.body.set_sort_order(headers[:parts_order])
- m.body.sort_parts!
+ if message.multipart?
+ message.body.set_sort_order(headers[:parts_order])
+ message.body.sort_parts!
end
- m
+ message
end
def apply_defaults(headers)