Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7de994fa
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,发现更多精彩内容 >>
提交
7de994fa
编写于
8月 28, 2013
作者:
Ł
Łukasz Strzałkowski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port all remaining self.protected_instance_variables to class methods
上级
55c9109b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
19 deletion
+21
-19
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+4
-2
actionpack/lib/abstract_controller/base.rb
actionpack/lib/abstract_controller/base.rb
+5
-0
actionpack/lib/abstract_controller/rendering.rb
actionpack/lib/abstract_controller/rendering.rb
+5
-11
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/base.rb
+6
-5
actionpack/test/controller/filters_test.rb
actionpack/test/controller/filters_test.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
7de994fa
...
...
@@ -373,8 +373,6 @@ class Base < AbstractController::Base
include
AbstractController
::
AssetPaths
include
AbstractController
::
Callbacks
self
.
protected_instance_variables
=
[
:@_action_has_layout
]
helper
ActionMailer
::
MailHelper
private_class_method
:new
#:nodoc:
...
...
@@ -387,6 +385,10 @@ class Base < AbstractController::Base
parts_order:
[
"text/plain"
,
"text/enriched"
,
"text/html"
]
}.
freeze
def
self
.
default_protected_instance_vars
super
.
concat
[
:@_action_has_layout
]
end
class
<<
self
# Register one or more Observers which will be notified when mail is delivered.
def
register_observers
(
*
observers
)
...
...
actionpack/lib/abstract_controller/base.rb
浏览文件 @
7de994fa
...
...
@@ -114,6 +114,11 @@ def method_added(name)
end
end
# Define some internal variables that should not be propagated to the view.
def
self
.
default_protected_instance_vars
[]
end
abstract!
# Calls the action going through the entire action dispatch stack.
...
...
actionpack/lib/abstract_controller/rendering.rb
浏览文件 @
7de994fa
...
...
@@ -13,13 +13,8 @@ def initialize(message = nil)
module
Rendering
extend
ActiveSupport
::
Concern
included
do
class_attribute
:protected_instance_variables
self
.
protected_instance_variables
=
[]
end
def
default_protected_instance_vars
[
:@_action_name
,
:@_response_body
,
:@_formats
,
:@_prefixes
,
:@_config
]
def
self
.
default_protected_instance_vars
super
.
concat
[
:@_action_name
,
:@_response_body
,
:@_formats
,
:@_prefixes
,
:@_config
]
end
# Raw rendering of a template to a string.
...
...
@@ -57,10 +52,9 @@ def rendered_format
# :api: public
def
view_assigns
hash
=
{}
variables
=
instance_variables
variables
-=
protected_instance_variables
variables
-=
default_protected_instance_vars
variables
.
each
{
|
name
|
hash
[
name
[
1
..-
1
]]
=
instance_variable_get
(
name
)
}
(
instance_variables
-
self
.
class
.
default_protected_instance_vars
).
each
do
|
name
|
hash
[
name
[
1
..-
1
]]
=
instance_variable_get
(
name
)
end
hash
end
...
...
actionpack/lib/action_controller/base.rb
浏览文件 @
7de994fa
...
...
@@ -261,11 +261,12 @@ def self.without_modules(*modules)
include
mod
end
# Define some internal variables that should not be propagated to the view.
self
.
protected_instance_variables
=
[
:@_status
,
:@_headers
,
:@_params
,
:@_env
,
:@_response
,
:@_request
,
:@_view_runtime
,
:@_stream
,
:@_url_options
,
:@_action_has_layout
]
def
self
.
default_protected_instance_vars
super
.
concat
[
:@_status
,
:@_headers
,
:@_params
,
:@_env
,
:@_response
,
:@_request
,
:@_view_runtime
,
:@_stream
,
:@_url_options
,
:@_action_has_layout
]
end
ActiveSupport
.
run_load_hooks
(
:action_controller
,
self
)
end
...
...
actionpack/test/controller/filters_test.rb
浏览文件 @
7de994fa
...
...
@@ -17,7 +17,7 @@ def before_filters
def
assigns
(
key
=
nil
)
assigns
=
{}
instance_variables
.
each
do
|
ivar
|
next
if
ActionController
::
Base
.
protected_instance_variable
s
.
include?
(
ivar
)
next
if
ActionController
::
Base
.
default_protected_instance_var
s
.
include?
(
ivar
)
assigns
[
ivar
[
1
..-
1
]]
=
instance_variable_get
(
ivar
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录