Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c1c4ecb9
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,发现更多精彩内容 >>
提交
c1c4ecb9
编写于
6月 20, 2012
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6801 from dmathieu/mailer_raise_if_no_implicit_template
Mailer with no implicit template
上级
b046ea45
45b1045d
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
30 addition
and
3 deletion
+30
-3
actionmailer/CHANGELOG.md
actionmailer/CHANGELOG.md
+4
-0
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+19
-3
actionmailer/test/base_test.rb
actionmailer/test/base_test.rb
+7
-0
actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb
...r/test/fixtures/base_mailer/attachment_with_hash.html.erb
+0
-0
actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb
...ase_mailer/attachment_with_hash_default_encoding.html.erb
+0
-0
actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb
...r/test/fixtures/base_mailer/welcome_with_headers.html.erb
+0
-0
actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb
...t/fixtures/base_test/after_filter_mailer/welcome.html.erb
+0
-0
actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb
.../fixtures/base_test/before_filter_mailer/welcome.html.erb
+0
-0
actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb
...se_test/default_inline_attachment_mailer/welcome.html.erb
+0
-0
actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb
...tures/mail_delivery_test/delivery_mailer/welcome.html.erb
+0
-0
actionmailer/test/fixtures/proc_mailer/welcome.html.erb
actionmailer/test/fixtures/proc_mailer/welcome.html.erb
+0
-0
未找到文件。
actionmailer/CHANGELOG.md
浏览文件 @
c1c4ecb9
## Rails 4.0.0 (unreleased) ##
*
Raise an
`ActionView::MissingTemplate`
exception when no implicit template could be found.
*Damien Mathieu*
## Rails 3.2.5 (Jun 1, 2012) ##
*
No changes.
...
...
actionmailer/lib/action_mailer/base.rb
浏览文件 @
c1c4ecb9
...
...
@@ -184,6 +184,16 @@ module ActionMailer #:nodoc:
# and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
# with the filename +free_book.pdf+.
#
# If you need to send attachments with no content, you need to create an empty view for it,
# or add an empty body parameter like this:
#
# class ApplicationMailer < ActionMailer::Base
# def welcome(recipient)
# attachments['free_book.pdf'] = File.read('path/to/file.pdf')
# mail(:to => recipient, :subject => "New account information", :body => "")
# end
# end
#
# = Inline Attachments
#
# You can also specify that a file should be displayed inline with other HTML. This is useful
...
...
@@ -598,8 +608,10 @@ def attachments
# end
# end
#
# Will look for all templates at "app/views/notifier" with name "welcome". However, those
# can be customized:
# Will look for all templates at "app/views/notifier" with name "welcome".
# If no welcome template exists, it will raise an ActionView::MissingTemplate error.
#
# However, those can be customized:
#
# mail(:template_path => 'notifications', :template_name => 'another')
#
...
...
@@ -733,7 +745,11 @@ def collect_responses_and_parts_order(headers) #:nodoc:
def
each_template
(
paths
,
name
,
&
block
)
#:nodoc:
templates
=
lookup_context
.
find_all
(
name
,
Array
(
paths
))
templates
.
uniq
{
|
t
|
t
.
formats
}.
each
(
&
block
)
if
templates
.
empty?
raise
ActionView
::
MissingTemplate
.
new
([
paths
],
name
,
[
paths
],
false
,
'mailer'
)
else
templates
.
uniq
{
|
t
|
t
.
formats
}.
each
(
&
block
)
end
end
def
create_parts_from_responses
(
m
,
responses
)
#:nodoc:
...
...
actionmailer/test/base_test.rb
浏览文件 @
c1c4ecb9
...
...
@@ -433,6 +433,13 @@ def teardown
assert_equal
(
"TEXT Implicit Multipart"
,
mail
.
text_part
.
body
.
decoded
)
end
test
"should raise if missing template in implicit render"
do
assert_raises
ActionView
::
MissingTemplate
do
BaseMailer
.
implicit_different_template
(
'missing_template'
).
deliver
end
assert_equal
(
0
,
BaseMailer
.
deliveries
.
length
)
end
test
"you can specify a different template for explicit render"
do
mail
=
BaseMailer
.
explicit_different_template
(
'explicit_multipart_templates'
).
deliver
assert_equal
(
"HTML Explicit Multipart Templates"
,
mail
.
html_part
.
body
.
decoded
)
...
...
actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
actionmailer/test/fixtures/proc_mailer/welcome.html.erb
0 → 100644
浏览文件 @
c1c4ecb9
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录