From e6b33a83376462619832fc51fb18929d4fc131db Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 15 Nov 2008 11:05:44 +0100 Subject: [PATCH] =?UTF-8?q?Added=20lambda=20merging=20to=20OptionMerger=20?= =?UTF-8?q?(especially=20useful=20with=20named=5Fscope=20and=20with=5Fopti?= =?UTF-8?q?ons)=20[#740=20state:commited]=20(Pawe=C5=82=20Kondzior)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actionmailer/CHANGELOG | 5 +++++ actionmailer/lib/action_mailer/part_container.rb | 6 +++++- actionmailer/test/mail_service_test.rb | 2 ++ activesupport/CHANGELOG | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG index de5aeab07eb1e..2cc84076fb670 100644 --- a/actionmailer/CHANGELOG +++ b/actionmailer/CHANGELOG @@ -1,3 +1,8 @@ +*2.3.0/3.0* + +* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior] + + *2.2.1 [RC2] (November 14th, 2008)* * Turn on STARTTLS if it is available in Net::SMTP (added in Ruby 1.8.7) and the SMTP server supports it (This is required for Gmail's SMTP server) #1336 [Grant Hollingworth] diff --git a/actionmailer/lib/action_mailer/part_container.rb b/actionmailer/lib/action_mailer/part_container.rb index 3e3d6b9d4f5e3..abfd8f84266ff 100644 --- a/actionmailer/lib/action_mailer/part_container.rb +++ b/actionmailer/lib/action_mailer/part_container.rb @@ -41,7 +41,11 @@ def attachment(params, &block) private def parse_content_type(defaults=nil) - return [defaults && defaults.content_type, {}] if content_type.blank? + if content_type.blank? + return defaults ? + [ defaults.content_type, { 'charset' => defaults.charset } ] : + [ nil, {} ] + end ctype, *attrs = content_type.split(/;\s*/) attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h } [ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)] diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index b88beb3314027..c49049cc6ae2a 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -915,6 +915,8 @@ def test_deliver_with_mail_object def test_multipart_with_template_path_with_dots mail = FunkyPathMailer.create_multipart_with_template_path_with_dots(@recipient) assert_equal 2, mail.parts.length + assert_equal 'text/plain', mail.parts[0].content_type + assert_equal 'utf-8', mail.parts[0].charset end def test_custom_content_type_attributes diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 2b0b296842e75..ee285f3ecb053 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,3 +1,8 @@ +*2.3.0/3.0* + +* Added lambda merging to OptionMerger (especially useful with named_scope and with_options) #740 [Paweł Kondzior] + + *2.2.1 [RC2] (November 14th, 2008)* * Increment the version of our altered memcache-client to prevent confusion caused when the 1.5.0 gem is installed.