Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
616ebb8f
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
616ebb8f
编写于
12月 28, 2009
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused code paths and require mail only when it's needed.
上级
c039bcdb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
17 deletion
+9
-17
actionmailer/lib/action_mailer.rb
actionmailer/lib/action_mailer.rb
+0
-3
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+8
-14
actionmailer/lib/action_mailer/test_case.rb
actionmailer/lib/action_mailer/test_case.rb
+1
-0
未找到文件。
actionmailer/lib/action_mailer.rb
浏览文件 @
616ebb8f
...
...
@@ -24,7 +24,6 @@
actionpack_path
=
File
.
expand_path
(
'../../../actionpack/lib'
,
__FILE__
)
$:
.
unshift
(
actionpack_path
)
if
File
.
directory?
(
actionpack_path
)
&&
!
$:
.
include?
(
actionpack_path
)
require
'action_controller'
require
'action_view'
...
...
@@ -46,5 +45,3 @@ module Text
autoload
:Format
,
'action_mailer/vendor/text_format'
end
require
'mail'
actionmailer/lib/action_mailer/base.rb
浏览文件 @
616ebb8f
require
'active_support/core_ext/class'
require
'mail'
module
ActionMailer
#:nodoc:
# Action Mailer allows you to send email from your application using a mailer model and views.
...
...
@@ -534,7 +535,7 @@ def create_parts #:nodoc:
if
String
===
response_body
@parts
.
unshift
create_inline_part
(
response_body
)
else
self
.
class
.
template_root
.
find_all
(
@template
,
{},
mailer_name
).
each
do
|
template
|
self
.
class
.
template_root
.
find_all
(
@template
,
{},
@
mailer_name
).
each
do
|
template
|
@parts
<<
create_inline_part
(
render_to_body
(
:_template
=>
template
),
template
.
mime_type
)
end
...
...
@@ -575,17 +576,14 @@ def create_mail #:nodoc:
real_content_type
,
ctype_attrs
=
parse_content_type
main_type
,
sub_type
=
split_content_type
(
real_content_type
)
if
@parts
.
empty?
m
.
content_type
([
main_type
,
sub_type
,
ctype_attrs
])
m
.
body
=
body
elsif
@parts
.
size
==
1
&&
@parts
.
first
.
parts
.
empty?
if
@parts
.
size
==
1
&&
@parts
.
first
.
parts
.
empty?
m
.
content_type
([
main_type
,
sub_type
,
ctype_attrs
])
m
.
body
=
@parts
.
first
.
body
.
encoded
else
@parts
.
each
do
|
p
|
m
.
add_part
(
p
)
end
m
.
body
.
set_sort_order
(
@implicit_parts_order
)
m
.
body
.
sort_parts!
...
...
@@ -603,16 +601,12 @@ def split_content_type(ct) #:nodoc:
end
def
parse_content_type
(
defaults
=
nil
)
#:nodoc:
if
content_type
.
blank?
if
defaults
[
defaults
.
content_type
,
{
'charset'
=>
defaults
.
charset
}
]
else
[
nil
,
{}
]
end
if
@content_type
.
blank?
[
nil
,
{}
]
else
ctype
,
*
attrs
=
content_type
.
split
(
/;\s*/
)
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
)]
[
ctype
,
{
"charset"
=>
@
charset
}.
merge
(
attrs
)]
end
end
...
...
actionmailer/lib/action_mailer/test_case.rb
浏览文件 @
616ebb8f
require
'active_support/test_case'
require
'mail'
module
ActionMailer
class
NonInferrableMailerError
<
::
StandardError
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录