Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
dc0411fa
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,体验更适合开发者的 AI 搜索 >>
提交
dc0411fa
编写于
9月 08, 2008
作者:
J
Jeremy Kemper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Check for uninitialized instance variables
上级
8b4461c1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
20 deletion
+24
-20
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/base.rb
+1
-1
actionpack/lib/action_view/base.rb
actionpack/lib/action_view/base.rb
+6
-4
actionpack/lib/action_view/renderable.rb
actionpack/lib/action_view/renderable.rb
+7
-7
actionpack/lib/action_view/renderable_partial.rb
actionpack/lib/action_view/renderable_partial.rb
+10
-8
未找到文件。
actionpack/lib/action_controller/base.rb
浏览文件 @
dc0411fa
...
...
@@ -453,7 +453,7 @@ def view_paths=(value)
# ArticleController.prepend_view_path(["views/default", "views/custom"])
#
def
prepend_view_path
(
path
)
@view_paths
=
superclass
.
view_paths
.
dup
if
@view_paths
.
nil?
@view_paths
=
superclass
.
view_paths
.
dup
if
!
defined?
(
@view_paths
)
||
@view_paths
.
nil?
@view_paths
.
unshift
(
*
path
)
end
...
...
actionpack/lib/action_view/base.rb
浏览文件 @
dc0411fa
...
...
@@ -278,9 +278,9 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
# the same name but differing formats. See +Request#template_format+
# for more details.
def
template_format
return
@template_format
if
@template_format
if
controller
&&
controller
.
respond_to?
(
:request
)
if
defined?
@template_format
@template_format
els
if
controller
&&
controller
.
respond_to?
(
:request
)
@template_format
=
controller
.
request
.
template_format
else
@template_format
=
:html
...
...
@@ -366,7 +366,9 @@ def _render_with_layout(options, local_assigns, &block) #:nodoc:
end
else
begin
original_content_for_layout
,
@content_for_layout
=
@content_for_layout
,
render
(
options
)
original_content_for_layout
=
@content_for_layout
if
defined?
(
@content_for_layout
)
@content_for_layout
=
render
(
options
)
if
(
options
[
:inline
]
||
options
[
:file
]
||
options
[
:text
])
@cached_content_for_layout
=
@content_for_layout
render
(
:file
=>
partial_layout
,
:locals
=>
local_assigns
)
...
...
actionpack/lib/action_view/renderable.rb
浏览文件 @
dc0411fa
module
ActionView
module
Renderable
# NOTE: The template that this mixin is beening include into is frozen
# So you can not set or modify any instance variables
# NOTE: The template that this mixin is being included into is frozen
# so you cannot set or modify any instance variables
module
Renderable
#:nodoc:
extend
ActiveSupport
::
Memoizable
def
self
.
included
(
base
)
...
...
@@ -33,10 +32,11 @@ def render(view, local_assigns = {})
view
.
send
(
:_set_controller_content_type
,
mime_type
)
if
respond_to?
(
:mime_type
)
view
.
send
(
method_name
(
local_assigns
),
local_assigns
)
do
|*
names
|
if
proc
=
view
.
instance_variable_get
(
"@_proc_for_layout"
)
ivar
=
:@_proc_for_layout
if
view
.
instance_variable_defined?
(
ivar
)
and
proc
=
view
.
instance_variable_get
(
ivar
)
view
.
capture
(
*
names
,
&
proc
)
els
e
view
.
instance_variable_get
(
"@content_for_
#{
names
.
first
||
'layout'
}
"
)
els
if
view
.
instance_variable_defined?
(
ivar
=
:"@content_for_
#{
names
.
first
||
:layout
}
"
)
view
.
instance_variable_get
(
ivar
)
end
end
end
...
...
actionpack/lib/action_view/renderable_partial.rb
浏览文件 @
dc0411fa
module
ActionView
module
RenderablePartial
# NOTE: The template that this mixin is beening include into is frozen
# So you can not set or modify any instance variables
# NOTE: The template that this mixin is being included into is frozen
# so you cannot set or modify any instance variables
module
RenderablePartial
#:nodoc:
extend
ActiveSupport
::
Memoizable
def
variable_name
...
...
@@ -30,10 +29,13 @@ def render_partial(view, object = nil, local_assigns = {}, as = nil)
local_assigns
[
variable_name
]
if
view
.
respond_to?
(
:controller
)
object
||=
ActiveSupport
::
Deprecation
::
DeprecatedObjectProxy
.
new
(
view
.
controller
.
instance_variable_get
(
"@
#{
variable_name
}
"
),
"@
#{
variable_name
}
will no longer be implicitly assigned to
#{
variable_name
}
"
)
ivar
=
:"@
#{
variable_name
}
"
object
||=
if
view
.
controller
.
instance_variable_defined?
(
ivar
)
ActiveSupport
::
Deprecation
::
DeprecatedObjectProxy
.
new
(
view
.
controller
.
instance_variable_get
(
ivar
),
"
#{
ivar
}
will no longer be implicitly assigned to
#{
variable_name
}
"
)
end
end
# Ensure correct object is reassigned to other accessors
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录