aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorChristian Felder (masone) <ema@rh-productions.ch>2014-09-19 10:32:08 +0200
committerChristian Felder (masone) <ema@rh-productions.ch>2014-09-22 15:52:48 +0200
commitb37e8482caee6d406ac5933fceb60cd2b74adfb7 (patch)
treea89307c6ddc50e85982b6fb42f252c6d3055b3aa /actionmailer/lib
parentc2dfc316912e780dfd6113e6ab9668128264f111 (diff)
downloadrails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.tar.gz
rails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.tar.bz2
rails-b37e8482caee6d406ac5933fceb60cd2b74adfb7.zip
Allow attaching files while the mail view is rendered
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb3
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index f539fc53c6..1ab68d2953 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -775,7 +775,6 @@ module ActionMailer
def mail(headers = {}, &block)
return @_message if @_mail_was_called && headers.blank? && !block
- @_mail_was_called = true
m = @_message
# At the beginning, do not consider class default for content_type
@@ -803,6 +802,8 @@ module ActionMailer
# Render the templates and blocks
responses = collect_responses(headers, &block)
+ @_mail_was_called = true
+
create_parts_from_responses(m, responses)
# Setup content type, reapply charset and handle parts order
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index 483277af04..cc7935a7e0 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -29,7 +29,7 @@ module ActionMailer
# Access the message attachments list.
def attachments
- @_message.attachments
+ mailer.attachments
end
# Returns +text+ wrapped at +len+ columns and indented +indent+ spaces.