From 04248c62086b188ae354ed90ae40c832b79fd19c Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 13 Aug 2008 19:04:56 -0500 Subject: Ensure templates are rendered if all the parts are already processed --- actionmailer/lib/action_mailer/base.rb | 5 +++-- actionmailer/test/fixtures/test_mailer/signed_up.erb | 3 --- actionmailer/test/fixtures/test_mailer/signed_up.html.erb | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 actionmailer/test/fixtures/test_mailer/signed_up.erb create mode 100644 actionmailer/test/fixtures/test_mailer/signed_up.html.erb (limited to 'actionmailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 1583fb4066..72c94529b5 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -470,8 +470,9 @@ module ActionMailer #:nodoc: # also render a "normal" template (without the content type). If a # normal template exists (or if there were no implicit parts) we render # it. - template = template_root["#{mailer_name}/#{@template}"] - @body = render_message(@template, @body) if template + template_exists = @parts.empty? + template_exists ||= template_root["#{mailer_name}/#{@template}"] + @body = render_message(@template, @body) if template_exists # Finally, if there are other message parts and a textual body exists, # we shift it onto the front of the parts and set the body to nil (so diff --git a/actionmailer/test/fixtures/test_mailer/signed_up.erb b/actionmailer/test/fixtures/test_mailer/signed_up.erb deleted file mode 100644 index a85d5fa442..0000000000 --- a/actionmailer/test/fixtures/test_mailer/signed_up.erb +++ /dev/null @@ -1,3 +0,0 @@ -Hello there, - -Mr. <%= @recipient %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/test_mailer/signed_up.html.erb b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb new file mode 100644 index 0000000000..a85d5fa442 --- /dev/null +++ b/actionmailer/test/fixtures/test_mailer/signed_up.html.erb @@ -0,0 +1,3 @@ +Hello there, + +Mr. <%= @recipient %> \ No newline at end of file -- cgit v1.2.3