Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
0c1846e4
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,发现更多精彩内容 >>
提交
0c1846e4
编写于
1月 07, 2012
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4377 from lest/instance-variables-1-9
get rid of using instance_variable_names method from AS
上级
ba168e8f
7d862359
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
14 addition
and
15 deletion
+14
-15
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+1
-1
actionpack/lib/abstract_controller/rendering.rb
actionpack/lib/abstract_controller/rendering.rb
+5
-6
actionpack/lib/action_controller/metal/compatibility.rb
actionpack/lib/action_controller/metal/compatibility.rb
+4
-4
actionpack/lib/action_controller/test_case.rb
actionpack/lib/action_controller/test_case.rb
+2
-2
actionpack/test/controller/filters_test.rb
actionpack/test/controller/filters_test.rb
+1
-1
activerecord/test/cases/associations/inner_join_association_test.rb
...rd/test/cases/associations/inner_join_association_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
0c1846e4
...
...
@@ -332,7 +332,7 @@ class Base < AbstractController::Base
include
AbstractController
::
Translation
include
AbstractController
::
AssetPaths
self
.
protected_instance_variables
=
%w(@_action_has_layout)
self
.
protected_instance_variables
=
[
:@_action_has_layout
]
helper
ActionMailer
::
MailHelper
...
...
actionpack/lib/abstract_controller/rendering.rb
浏览文件 @
0c1846e4
require
"abstract_controller/base"
require
"action_view"
require
"active_support/core_ext/object/instance_variables"
module
AbstractController
class
DoubleRenderError
<
Error
...
...
@@ -109,17 +108,17 @@ def _render_template(options) #:nodoc:
view_renderer
.
render
(
view_context
,
options
)
end
DEFAULT_PROTECTED_INSTANCE_VARIABLES
=
%w(
@_action_name @_response_body @_formats @_prefixes @_config
@_view_context_class @_view_renderer
@_lookup_context
)
DEFAULT_PROTECTED_INSTANCE_VARIABLES
=
[
:@_action_name
,
:@_response_body
,
:@_formats
,
:@_prefixes
,
:@_config
,
:@_view_context_class
,
:@_view_renderer
,
:
@_lookup_context
]
# This method should return a hash with assigns.
# You can overwrite this configuration per controller.
# :api: public
def
view_assigns
hash
=
{}
variables
=
instance_variable
_name
s
variables
=
instance_variables
variables
-=
protected_instance_variables
variables
-=
DEFAULT_PROTECTED_INSTANCE_VARIABLES
variables
.
each
{
|
name
|
hash
[
name
.
to_s
[
1
,
name
.
length
]]
=
instance_variable_get
(
name
)
}
...
...
actionpack/lib/action_controller/metal/compatibility.rb
浏览文件 @
0c1846e4
...
...
@@ -18,10 +18,10 @@ class << self
delegate
:default_charset
=
,
:to
=>
"ActionDispatch::Response"
end
self
.
protected_instance_variables
=
%w(
@_status @_headers @_params @_env @_response @_request
@_view_runtime @_stream @_url_options
@_action_has_layout
)
self
.
protected_instance_variables
=
[
:@_status
,
:@_headers
,
:@_params
,
:@_env
,
:@_response
,
:@_request
,
:@_view_runtime
,
:@_stream
,
:@_url_options
,
:
@_action_has_layout
]
def
rescue_action
(
env
)
raise
env
[
"action_dispatch.rescue.exception"
]
...
...
actionpack/lib/action_controller/test_case.rb
浏览文件 @
0c1846e4
...
...
@@ -506,8 +506,8 @@ def rescue_action_in_public!
def
check_required_ivars
# Sanity check for required instance variables so we can give an
# understandable error message.
%w(@routes @controller @request @response)
.
each
do
|
iv_name
|
if
!
(
instance_variable_names
.
include?
(
iv_name
)
||
instance_variable_names
.
include?
(
iv_name
.
to_sym
)
)
||
instance_variable_get
(
iv_name
).
nil?
[
:@routes
,
:@controller
,
:@request
,
:@response
]
.
each
do
|
iv_name
|
if
!
instance_variable_defined?
(
iv_name
)
||
instance_variable_get
(
iv_name
).
nil?
raise
"
#{
iv_name
}
is nil: make sure you set it in your test's setup method."
end
end
...
...
actionpack/test/controller/filters_test.rb
浏览文件 @
0c1846e4
...
...
@@ -16,7 +16,7 @@ def before_filters
def
assigns
(
key
=
nil
)
assigns
=
{}
instance_variable
_name
s
.
each
do
|
ivar
|
instance_variables
.
each
do
|
ivar
|
next
if
ActionController
::
Base
.
protected_instance_variables
.
include?
(
ivar
)
assigns
[
ivar
[
1
..-
1
]]
=
instance_variable_get
(
ivar
)
end
...
...
activerecord/test/cases/associations/inner_join_association_test.rb
浏览文件 @
0c1846e4
...
...
@@ -67,7 +67,7 @@ def test_find_with_implicit_inner_joins_honors_readonly_false
def
test_find_with_implicit_inner_joins_does_not_set_associations
authors
=
Author
.
joins
(
:posts
).
select
(
'authors.*'
)
assert
!
authors
.
empty?
,
"expected authors to be non-empty"
assert
authors
.
all?
{
|
a
|
!
a
.
send
(
:instance_variable_names
).
include?
(
"@posts"
)
},
"expected no authors to have the @posts association loaded"
assert
authors
.
all?
{
|
a
|
!
a
.
instance_variable_defined?
(
:@posts
)
},
"expected no authors to have the @posts association loaded"
end
def
test_count_honors_implicit_inner_joins
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录