Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
07635a74
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,发现更多精彩内容 >>
提交
07635a74
编写于
9月 23, 2014
作者:
G
Godfrey Chan
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16888 from jejacks0n/render_template
Changes default render behavior from file to template.
上级
1b5f61a0
428722ba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
20 deletion
+7
-20
actionview/lib/action_view/rendering.rb
actionview/lib/action_view/rendering.rb
+2
-2
actionview/test/actionpack/controller/render_test.rb
actionview/test/actionpack/controller/render_test.rb
+5
-18
未找到文件。
actionview/lib/action_view/rendering.rb
浏览文件 @
07635a74
...
...
@@ -108,7 +108,7 @@ def _process_format(format, options = {}) #:nodoc:
end
# Normalize args by converting render "foo" to render :action => "foo" and
# render "foo/bar" to render :
fil
e => "foo/bar".
# render "foo/bar" to render :
templat
e => "foo/bar".
# :api: private
def
_normalize_args
(
action
=
nil
,
options
=
{})
options
=
super
(
action
,
options
)
...
...
@@ -118,7 +118,7 @@ def _normalize_args(action=nil, options={})
options
=
action
when
String
,
Symbol
action
=
action
.
to_s
key
=
action
.
include?
(
?/
)
?
:
fil
e
:
:action
key
=
action
.
include?
(
?/
)
?
:
templat
e
:
:action
options
[
key
]
=
action
else
options
[
:partial
]
=
action
...
...
actionview/test/actionpack/controller/render_test.rb
浏览文件 @
07635a74
...
...
@@ -91,17 +91,17 @@ def hello_world_file
# :ported:
def
render_hello_world
render
:template
=>
"test/hello_world"
render
"test/hello_world"
end
def
render_hello_world_with_last_modified_set
response
.
last_modified
=
Date
.
new
(
2008
,
10
,
10
).
to_time
render
:template
=>
"test/hello_world"
render
"test/hello_world"
end
# :ported: compatibility
def
render_hello_world_with_forward_slash
render
:template
=>
"/test/hello_world"
render
"/test/hello_world"
end
# :ported:
...
...
@@ -111,7 +111,7 @@ def render_template_in_top_directory
# :deprecated:
def
render_template_in_top_directory_with_slash
render
:template
=>
'/shared'
render
'/shared'
end
# :ported:
...
...
@@ -159,13 +159,6 @@ def render_file_with_instance_variables
render
:file
=>
path
end
# :ported:
def
render_file_as_string_with_instance_variables
@secret
=
'in the sauce'
path
=
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'../../fixtures/test/render_file_with_ivar'
))
render
path
end
# :ported:
def
render_file_not_using_full_path
@secret
=
'in the sauce'
...
...
@@ -194,7 +187,7 @@ def render_file_with_locals
def
render_file_as_string_with_locals
path
=
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'../../fixtures/test/render_file_with_locals'
))
render
path
,
:locals
=>
{
:secret
=>
'in the sauce'
}
render
file:
path
,
:locals
=>
{
:secret
=>
'in the sauce'
}
end
def
accessing_request_in_template
...
...
@@ -793,12 +786,6 @@ def test_render_file
assert_equal
"Hello world!"
,
@response
.
body
end
# :ported:
def
test_render_file_as_string_with_instance_variables
get
:render_file_as_string_with_instance_variables
assert_equal
"The secret is in the sauce
\n
"
,
@response
.
body
end
# :ported:
def
test_render_file_not_using_full_path
get
:render_file_not_using_full_path
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录