Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1df157cd
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,发现更多精彩内容 >>
提交
1df157cd
编写于
10月 28, 2008
作者:
D
David Heinemeier Hansson
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of git@github.com:rails/rails
上级
3e54a9a6
ac50ee0e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
14 deletion
+24
-14
actionpack/lib/action_controller/routing/recognition_optimisation.rb
...lib/action_controller/routing/recognition_optimisation.rb
+1
-7
actionpack/lib/action_controller/test_process.rb
actionpack/lib/action_controller/test_process.rb
+1
-1
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+8
-3
actionpack/lib/action_view/renderable.rb
actionpack/lib/action_view/renderable.rb
+9
-3
actionpack/test/fixtures/test/template.erb
actionpack/test/fixtures/test/template.erb
+1
-0
actionpack/test/template/render_test.rb
actionpack/test/template/render_test.rb
+4
-0
未找到文件。
actionpack/lib/action_controller/routing/recognition_optimisation.rb
浏览文件 @
1df157cd
...
...
@@ -153,13 +153,7 @@ def recognize_optimized(path, env)
def
clear_recognize_optimized!
remove_recognize_optimized!
class
<<
self
def
recognize_optimized
(
path
,
environment
)
write_recognize_optimized!
recognize_optimized
(
path
,
environment
)
end
end
write_recognize_optimized!
end
def
remove_recognize_optimized!
...
...
actionpack/lib/action_controller/test_process.rb
浏览文件 @
1df157cd
...
...
@@ -218,7 +218,7 @@ def redirect_url_match?( pattern )
# Returns the template of the file which was used to
# render this response (or nil)
def
rendered_template
template
.
send
(
:
_first_render
)
template
.
instance_variable_get
(
:@
_first_render
)
end
# A shortcut to the flash. Returns an empty hash if no session flash exists.
...
...
actionpack/lib/action_view/base.rb
浏览文件 @
1df157cd
...
...
@@ -222,6 +222,7 @@ def include(*args)
def
initialize
(
view_paths
=
[],
assigns_for_first_render
=
{},
controller
=
nil
)
#:nodoc:
@assigns
=
assigns_for_first_render
@assigns_added
=
nil
@_render_stack
=
[]
@controller
=
controller
@helpers
=
ProxyModule
.
new
(
self
)
self
.
view_paths
=
view_paths
...
...
@@ -271,9 +272,13 @@ def template_format
end
end
private
attr_accessor
:_first_render
,
:_last_render
# Access the current template being rendered.
# Returns a ActionView::Template object.
def
template
@_render_stack
.
last
end
private
# Evaluates the local assigns and controller ivars, pushes them to the view.
def
_evaluate_assigns_and_ivars
#:nodoc:
unless
@assigns_added
...
...
@@ -312,7 +317,7 @@ def _pick_template(template_path)
template
elsif
template
=
self
.
view_paths
[
template_file_name
]
template
elsif
_first_render
&&
template
=
self
.
view_paths
[
"
#{
template_file_name
}
.
#{
_first_render
.
format_and_extension
}
"
]
elsif
@_render_stack
.
first
&&
template
=
self
.
view_paths
[
"
#{
template_file_name
}
.
#{
@_render_stack
.
first
.
format_and_extension
}
"
]
template
elsif
template_format
==
:js
&&
template
=
self
.
view_paths
[
"
#{
template_file_name
}
.html"
]
@template_format
=
:html
...
...
actionpack/lib/action_view/renderable.rb
浏览文件 @
1df157cd
...
...
@@ -25,13 +25,16 @@ def compiled_source
def
render
(
view
,
local_assigns
=
{})
compile
(
local_assigns
)
view
.
send
(
:_first_render
=
,
self
)
unless
view
.
send
(
:_first_render
)
view
.
send
(
:_last_render
=
,
self
)
stack
=
view
.
instance_variable_get
(
:@_render_stack
)
stack
.
push
(
self
)
# This is only used for TestResponse to set rendered_template
view
.
instance_variable_set
(
:@_first_render
,
self
)
unless
view
.
instance_variable_get
(
:@_first_render
)
view
.
send
(
:_evaluate_assigns_and_ivars
)
view
.
send
(
:_set_controller_content_type
,
mime_type
)
if
respond_to?
(
:mime_type
)
view
.
send
(
method_name
(
local_assigns
),
local_assigns
)
do
|*
names
|
result
=
view
.
send
(
method_name
(
local_assigns
),
local_assigns
)
do
|*
names
|
ivar
=
:@_proc_for_layout
if
view
.
instance_variable_defined?
(
ivar
)
and
proc
=
view
.
instance_variable_get
(
ivar
)
view
.
capture
(
*
names
,
&
proc
)
...
...
@@ -39,6 +42,9 @@ def render(view, local_assigns = {})
view
.
instance_variable_get
(
ivar
)
end
end
stack
.
pop
result
end
def
method_name
(
local_assigns
)
...
...
actionpack/test/fixtures/test/template.erb
0 → 100644
浏览文件 @
1df157cd
<%=
template
.
path
%>
\ No newline at end of file
actionpack/test/template/render_test.rb
浏览文件 @
1df157cd
...
...
@@ -41,6 +41,10 @@ def test_render_file_not_using_full_path_with_dot_in_path
assert_equal
"The secret is in the sauce
\n
"
,
@view
.
render
(
"test/dot.directory/render_file_with_ivar"
)
end
def
test_render_has_access_current_template
assert_equal
"test/template.erb"
,
@view
.
render
(
"test/template.erb"
)
end
def
test_render_update
# TODO: You should not have to stub out template because template is self!
@view
.
instance_variable_set
(
:@template
,
@view
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录