aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-11-23 15:29:35 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-23 15:29:35 -0800
commit671538cd6ea0bd4c463e7bf7d238a55924a8af53 (patch)
tree661710f2df243f02452846c3e85f2980acbf813a /actionmailer/lib/action_mailer
parentca5de16ddc50b4f8d8a88e91571f5c5a2c8c751c (diff)
parent3a72923e27195983d37bdb39ef26b29cf03d3483 (diff)
downloadrails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.tar.gz
rails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.tar.bz2
rails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.zip
Merge commit 'mikel/master' into mail
Conflicts: actionmailer/lib/action_mailer.rb
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb17
-rw-r--r--actionmailer/lib/action_mailer/utils.rb7
2 files changed, 11 insertions, 13 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 9d7af72362..3639992ce9 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -251,7 +251,7 @@ module ActionMailer #:nodoc:
# and appear last in the mime encoded message. You can also pick a different order from inside a method with
# +implicit_parts_order+.
class Base
- include AdvAttrAccessor, Quoting, Utils
+ include AdvAttrAccessor, Quoting
include AbstractController::RenderingController
include AbstractController::LocalizedCache
@@ -372,8 +372,9 @@ module ActionMailer #:nodoc:
def part(params)
params = {:content_type => params} if String === params
if custom_headers = params.delete(:headers)
- STDERR.puts("Passing custom headers with :headers => {} is deprecated. Please just pass in custom headers directly.")
- params = params.merge(custom_headers)
+ ActiveSupport::Deprecation.warn('Passing custom headers with :headers => {} is deprecated. ' <<
+ 'Please just pass in custom headers directly.', caller[0,10])
+ params.merge!(custom_headers)
end
part = Mail::Part.new(params)
yield part if block_given?
@@ -386,7 +387,11 @@ module ActionMailer #:nodoc:
params = { :content_type => params } if String === params
params = { :content_disposition => "attachment",
:content_transfer_encoding => "base64" }.merge(params)
- params[:data] = params.delete(:body) if params[:body]
+ if params[:body]
+ ActiveSupport::Deprecation.warn('attachment :body => "string" is deprecated. To set the body of an attachment ' <<
+ 'please use :data instead, like attachment :data => "string".', caller[0,10])
+ params[:data] = params.delete(:body)
+ end
part(params, &block)
end
@@ -619,11 +624,11 @@ module ActionMailer #:nodoc:
if @parts.empty?
main_type, sub_type = split_content_type(real_content_type)
m.content_type([main_type, sub_type, ctype_attrs])
- m.body = normalize_new_lines(body)
+ m.body = body
elsif @parts.size == 1 && @parts.first.parts.empty?
main_type, sub_type = split_content_type(real_content_type)
m.content_type([main_type, sub_type, ctype_attrs])
- m.body = normalize_new_lines(@parts.first.body)
+ m.body = @parts.first.body.encoded
else
@parts.each do |p|
m.add_part(p)
diff --git a/actionmailer/lib/action_mailer/utils.rb b/actionmailer/lib/action_mailer/utils.rb
deleted file mode 100644
index 26d2e60aaf..0000000000
--- a/actionmailer/lib/action_mailer/utils.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module ActionMailer
- module Utils #:nodoc:
- def normalize_new_lines(text)
- text.to_s.gsub(/\r\n?/, "\n")
- end
- end
-end