提交 cc391c30 编写于 作者: M Mikel Lindsaar

Deprecating attachment :body => 'string' in favour of attachment :data => 'string'

上级 a6eed86c
......@@ -386,7 +386,11 @@ def attachment(params, &block)
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
......
......@@ -9,7 +9,7 @@ def multipart_with_template_path_with_dots(recipient)
subject "This path has dots"
from "Chad Fowler <chad@chadfowler.com>"
attachment :content_type => "text/plain",
:body => "dots dots dots..."
:data => "dots dots dots..."
end
end
......@@ -144,7 +144,7 @@ def explicitly_multipart_example(recipient, ct=nil)
end
attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "foo.jpg"),
:body => "123456789"
:data => "123456789"
render :text => "plain text default"
end
......@@ -232,7 +232,7 @@ def nested_multipart(recipient)
p.part :content_type => "text/html", :body => "<b>test</b> HTML<br/>\nline #2"
end
attachment :content_type => "application/octet-stream", :filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz"
attachment :content_type => "application/octet-stream", :filename => "test.txt", :data => "test abcdefghijklmnopqstuvwxyz"
end
def nested_multipart_with_body(recipient)
......@@ -252,7 +252,7 @@ def attachment_with_custom_header(recipient)
from "test@example.com"
content_type "multipart/related"
part :content_type => "text/html", :body => 'yo'
attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :body => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' }
attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :data => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' }
end
def unnamed_attachment(recipient)
......@@ -261,7 +261,7 @@ def unnamed_attachment(recipient)
from "test@example.com"
content_type "multipart/mixed"
part :content_type => "text/plain", :body => "hullo"
attachment :content_type => "application/octet-stream", :body => "test abcdefghijklmnopqstuvwxyz"
attachment :content_type => "application/octet-stream", :data => "test abcdefghijklmnopqstuvwxyz"
end
def headers_with_nonalpha_chars(recipient)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册