diff options
-rw-r--r-- | actionmailer/CHANGELOG | 5 | ||||
-rw-r--r-- | actionmailer/test/mail_render_test.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_view/base.rb | 3 |
3 files changed, 18 insertions, 1 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index 492474e028..c7fadfed39 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,3 +1,8 @@ +*SVN* + +* Fix silent failure of rxml templates. #9879 [jstewart] + + *2.0.0 [Preview Release]* (September 29th, 2007) * Fix attachment decoding when using the TMail C extension. #7861 [orangechicken] diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb index 42454fef6e..a725dac4ca 100644 --- a/actionmailer/test/mail_render_test.rb +++ b/actionmailer/test/mail_render_test.rb @@ -15,6 +15,12 @@ class RenderMailer < ActionMailer::Base body render(:file => "signed_up", :body => { :recipient => recipient }) end + def rxml_template(recipient) + recipients recipient + subject "rendering rxml template" + from "tester@example.com" + end + def initialize_defaults(method_name) super mailer_name "test_mailer" @@ -55,6 +61,11 @@ class RenderHelperTest < Test::Unit::TestCase mail = RenderMailer.create_file_template(@recipient) assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip end + + def test_rxml_template + mail = RenderMailer.deliver_rxml_template(@recipient) + assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip + end end class FirstSecondHelperTest < Test::Unit::TestCase diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 61b66add52..7bff8c00c2 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -572,7 +572,8 @@ module ActionView #:nodoc: if template_requires_setup?(extension) body = case extension.to_sym when :rxml, :builder - "controller.response.content_type ||= Mime::XML\n" + + content_type_handler = (controller.respond_to?(:response) ? "controller.response" : "controller") + "#{content_type_handler}.content_type ||= Mime::XML\n" + "xml = Builder::XmlMarkup.new(:indent => 2)\n" + template + "\nxml.target!\n" |