Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
dd58f402
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,发现更多精彩内容 >>
提交
dd58f402
编写于
6月 16, 2009
作者:
Y
Yehuda Katz + Carl Lerche
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
An exception is raised if a layout is missing only if the layout is missing for all mimes
上级
01a4bc84
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
5 addition
and
11 deletion
+5
-11
actionpack/lib/action_controller/abstract/layouts.rb
actionpack/lib/action_controller/abstract/layouts.rb
+2
-0
actionpack/lib/action_controller/base/layouts.rb
actionpack/lib/action_controller/base/layouts.rb
+2
-2
actionpack/lib/action_controller/base/mime_responds.rb
actionpack/lib/action_controller/base/mime_responds.rb
+1
-1
actionpack/test/controller/mime_responds_test.rb
actionpack/test/controller/mime_responds_test.rb
+0
-8
未找到文件。
actionpack/lib/action_controller/abstract/layouts.rb
浏览文件 @
dd58f402
...
...
@@ -140,6 +140,8 @@ def _default_layout(details, require_layout = false)
rescue
NameError
=>
e
raise
NoMethodError
,
"You specified
#{
@_layout
.
inspect
}
as the layout, but no such method was found"
rescue
ActionView
::
MissingTemplate
_find_by_parts
(
_layout
({}),
{})
end
end
...
...
actionpack/lib/action_controller/base/layouts.rb
浏览文件 @
dd58f402
...
...
@@ -176,7 +176,7 @@ def _determine_template(options)
super
return
if
(
options
.
key?
(
:text
)
||
options
.
key?
(
:inline
)
||
options
.
key?
(
:partial
))
&&
!
options
.
key?
(
:layout
)
layout
=
options
.
key?
(
:layout
)
?
options
[
:layout
]
:
:
none
layout
=
options
.
key?
(
:layout
)
?
options
[
:layout
]
:
:
default
options
[
:_layout
]
=
_layout_for_option
(
layout
,
options
[
:_template
].
details
)
end
...
...
@@ -184,7 +184,7 @@ def _layout_for_option(name, details)
case
name
when
String
then
_layout_for_name
(
name
,
details
)
when
true
then
_default_layout
(
details
,
true
)
when
:
none
then
_default_layout
(
details
,
false
)
when
:
default
then
_default_layout
(
details
,
false
)
when
false
,
nil
then
nil
else
raise
ArgumentError
,
...
...
actionpack/lib/action_controller/base/mime_responds.rb
浏览文件 @
dd58f402
...
...
@@ -124,8 +124,8 @@ def custom(mime_type, &block)
@controller
.
formats
=
[
mime_type
.
to_sym
]
end
@controller
.
content_type
=
mime_type
@controller
.
template
.
formats
=
[
mime_type
.
to_sym
]
@response
.
content_type
=
mime_type
block_given?
?
block
.
call
:
@controller
.
send
(
:render
,
:action
=>
@controller
.
action_name
)
end
...
...
actionpack/test/controller/mime_responds_test.rb
浏览文件 @
dd58f402
...
...
@@ -467,14 +467,6 @@ def test_format_with_custom_response_type_and_request_headers
assert_equal
'<html><div id="iphone">Hello iPhone future from iPhone!</div></html>'
,
@response
.
body
assert_equal
"text/html"
,
@response
.
content_type
end
def
test_format_with_custom_response_type_and_request_headers_with_only_one_layout_present
get
:iphone_with_html_response_type_without_layout
assert_equal
'<html><div id="html_missing">Hello future from Firefox!</div></html>'
,
@response
.
body
@request
.
accept
=
"text/iphone"
assert_raise
(
ActionView
::
MissingTemplate
)
{
get
:iphone_with_html_response_type_without_layout
}
end
end
class
AbstractPostController
<
ActionController
::
Base
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录