Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c5ac6da5
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,发现更多精彩内容 >>
提交
c5ac6da5
编写于
9月 07, 2012
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7560 from bogdan/deprecate_callbacks_monkeypatch
AS::Callbacks: deprecate monkey patch of object callbacks
上级
e20a790b
6777f7b7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
8 deletion
+9
-8
actionpack/lib/action_controller/caching/actions.rb
actionpack/lib/action_controller/caching/actions.rb
+1
-1
actionpack/test/controller/filters_test.rb
actionpack/test/controller/filters_test.rb
+7
-7
activesupport/lib/active_support/callbacks.rb
activesupport/lib/active_support/callbacks.rb
+1
-0
未找到文件。
actionpack/lib/action_controller/caching/actions.rb
浏览文件 @
c5ac6da5
...
@@ -132,7 +132,7 @@ def initialize(options, &block)
...
@@ -132,7 +132,7 @@ def initialize(options, &block)
options
.
values_at
(
:cache_path
,
:store_options
,
:layout
)
options
.
values_at
(
:cache_path
,
:store_options
,
:layout
)
end
end
def
filter
(
controller
)
def
around
(
controller
)
cache_layout
=
@cache_layout
.
respond_to?
(
:call
)
?
@cache_layout
.
call
(
controller
)
:
@cache_layout
cache_layout
=
@cache_layout
.
respond_to?
(
:call
)
?
@cache_layout
.
call
(
controller
)
:
@cache_layout
path_options
=
if
@cache_path
.
respond_to?
(
:call
)
path_options
=
if
@cache_path
.
respond_to?
(
:call
)
...
...
actionpack/test/controller/filters_test.rb
浏览文件 @
c5ac6da5
...
@@ -193,7 +193,7 @@ class ExceptConditionProcController < ConditionalFilterController
...
@@ -193,7 +193,7 @@ class ExceptConditionProcController < ConditionalFilterController
end
end
class
ConditionalClassFilter
class
ConditionalClassFilter
def
self
.
filter
(
controller
)
controller
.
instance_variable_set
(
:"@ran_class_filter"
,
true
)
end
def
self
.
before
(
controller
)
controller
.
instance_variable_set
(
:"@ran_class_filter"
,
true
)
end
end
end
class
OnlyConditionClassController
<
ConditionalFilterController
class
OnlyConditionClassController
<
ConditionalFilterController
...
@@ -309,7 +309,7 @@ class ImplicitProcController < PrependingController
...
@@ -309,7 +309,7 @@ class ImplicitProcController < PrependingController
end
end
class
AuditFilter
class
AuditFilter
def
self
.
filter
(
controller
)
def
self
.
before
(
controller
)
controller
.
instance_variable_set
(
:"@was_audited"
,
true
)
controller
.
instance_variable_set
(
:"@was_audited"
,
true
)
end
end
end
end
...
@@ -449,7 +449,7 @@ def show
...
@@ -449,7 +449,7 @@ def show
class
ErrorToRescue
<
Exception
;
end
class
ErrorToRescue
<
Exception
;
end
class
RescuingAroundFilterWithBlock
class
RescuingAroundFilterWithBlock
def
filter
(
controller
)
def
around
(
controller
)
begin
begin
yield
yield
rescue
ErrorToRescue
=>
ex
rescue
ErrorToRescue
=>
ex
...
@@ -894,7 +894,7 @@ def without_exception
...
@@ -894,7 +894,7 @@ def without_exception
class
ControllerWithFilterClass
<
PostsController
class
ControllerWithFilterClass
<
PostsController
class
YieldingFilter
<
DefaultFilter
class
YieldingFilter
<
DefaultFilter
def
self
.
filter
(
controller
)
def
self
.
around
(
controller
)
yield
yield
raise
After
raise
After
end
end
...
@@ -905,7 +905,7 @@ def self.filter(controller)
...
@@ -905,7 +905,7 @@ def self.filter(controller)
class
ControllerWithFilterInstance
<
PostsController
class
ControllerWithFilterInstance
<
PostsController
class
YieldingFilter
<
DefaultFilter
class
YieldingFilter
<
DefaultFilter
def
filter
(
controller
)
def
around
(
controller
)
yield
yield
raise
After
raise
After
end
end
...
@@ -916,13 +916,13 @@ def filter(controller)
...
@@ -916,13 +916,13 @@ def filter(controller)
class
ControllerWithFilterMethod
<
PostsController
class
ControllerWithFilterMethod
<
PostsController
class
YieldingFilter
<
DefaultFilter
class
YieldingFilter
<
DefaultFilter
def
filter
(
controller
)
def
around
(
controller
)
yield
yield
raise
After
raise
After
end
end
end
end
around_filter
YieldingFilter
.
new
.
method
(
:
filter
),
:only
=>
:raises_after
around_filter
YieldingFilter
.
new
.
method
(
:
around
),
:only
=>
:raises_after
end
end
class
ControllerWithProcFilter
<
PostsController
class
ControllerWithProcFilter
<
PostsController
...
...
activesupport/lib/active_support/callbacks.rb
浏览文件 @
c5ac6da5
...
@@ -279,6 +279,7 @@ def #{method_name}(&blk)
...
@@ -279,6 +279,7 @@ def #{method_name}(&blk)
def
_normalize_legacy_filter
(
kind
,
filter
)
def
_normalize_legacy_filter
(
kind
,
filter
)
if
!
filter
.
respond_to?
(
kind
)
&&
filter
.
respond_to?
(
:filter
)
if
!
filter
.
respond_to?
(
kind
)
&&
filter
.
respond_to?
(
:filter
)
ActiveSupport
::
Deprecation
.
warn
(
"Filter object with #filter method is deprecated. Define method corresponding to filter type (#before, #after or #around)."
)
filter
.
singleton_class
.
class_eval
<<-
RUBY_EVAL
,
__FILE__
,
__LINE__
+
1
filter
.
singleton_class
.
class_eval
<<-
RUBY_EVAL
,
__FILE__
,
__LINE__
+
1
def
#{
kind
}
(context, &block) filter(context, &block) end
def
#{
kind
}
(context, &block) filter(context, &block) end
RUBY_EVAL
RUBY_EVAL
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录