Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
a74041d4
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,发现更多精彩内容 >>
提交
a74041d4
编写于
1月 08, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18410 from seuros/ripfilter
remove *_filter
上级
b8e83ce1
7644a99d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
9 deletion
+37
-9
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+5
-1
actionpack/lib/abstract_controller/callbacks.rb
actionpack/lib/abstract_controller/callbacks.rb
+27
-5
actionpack/test/abstract/callbacks_test.rb
actionpack/test/abstract/callbacks_test.rb
+5
-3
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
a74041d4
*
Allow you to pass
`prepend: false`
to protect_from_forgery to have the
*
Deprecate all
*_filter callbacks in favor of *
_action callbacks.
*Rafael Mendonça França*
*
Allow you to pass
`prepend: false`
to protect_from_forgery to have the
verification callback appended instead of prepended to the chain.
This allows you to let the verification step depend on prior callbacks.
Example:
...
...
actionpack/lib/abstract_controller/callbacks.rb
浏览文件 @
a74041d4
require
'active_support/deprecation'
module
AbstractController
module
Callbacks
extend
ActiveSupport
::
Concern
...
...
@@ -65,7 +67,11 @@ def skip_action_callback(*names)
skip_after_action
(
*
names
)
skip_around_action
(
*
names
)
end
alias_method
:skip_filter
,
:skip_action_callback
def
skip_filter
(
*
names
)
ActiveSupport
::
Deprecation
.
warn
(
"
#{
callback
}
_filter is deprecated and will removed in Rails 5.1. Use
#{
callback
}
_action instead."
)
skip_action_callback
(
*
names
)
end
# Take callback names and an optional callback proc, normalize them,
# then call the block with each callback. This allows us to abstract
...
...
@@ -180,14 +186,22 @@ def _insert_callbacks(callbacks, block = nil)
set_callback
(
:process_action
,
callback
,
name
,
options
)
end
end
alias_method
:"
#{
callback
}
_filter"
,
:"
#{
callback
}
_action"
define_method
"
#{
callback
}
_filter"
do
|*
names
,
&
blk
|
ActiveSupport
::
Deprecation
.
warn
(
"
#{
callback
}
_filter is deprecated and will removed in Rails 5.1. Use
#{
callback
}
_action instead."
)
send
(
"
#{
callback
}
_action"
,
*
names
,
&
blk
)
end
define_method
"prepend_
#{
callback
}
_action"
do
|*
names
,
&
blk
|
_insert_callbacks
(
names
,
blk
)
do
|
name
,
options
|
set_callback
(
:process_action
,
callback
,
name
,
options
.
merge
(
:prepend
=>
true
))
end
end
alias_method
:"prepend_
#{
callback
}
_filter"
,
:"prepend_
#{
callback
}
_action"
define_method
"prepend_
#{
callback
}
_filter"
do
|*
names
,
&
blk
|
ActiveSupport
::
Deprecation
.
warn
(
"prepend_
#{
callback
}
_filter is deprecated and will removed in Rails 5.1. Use prepend_
#{
callback
}
_action instead."
)
send
(
"prepend_
#{
callback
}
_action"
,
*
names
,
&
blk
)
end
# Skip a before, after or around callback. See _insert_callbacks
# for details on the allowed parameters.
...
...
@@ -196,11 +210,19 @@ def _insert_callbacks(callbacks, block = nil)
skip_callback
(
:process_action
,
callback
,
name
,
options
)
end
end
alias_method
:"skip_
#{
callback
}
_filter"
,
:"skip_
#{
callback
}
_action"
define_method
"skip_
#{
callback
}
_filter"
do
|*
names
,
&
blk
|
ActiveSupport
::
Deprecation
.
warn
(
"skip_
#{
callback
}
_filter is deprecated and will removed in Rails 5.1. Use skip_
#{
callback
}
_action instead."
)
send
(
"skip_
#{
callback
}
_action"
,
*
names
,
&
blk
)
end
# *_action is the same as append_*_action
alias_method
:"append_
#{
callback
}
_action"
,
:"
#{
callback
}
_action"
alias_method
:"append_
#{
callback
}
_filter"
,
:"
#{
callback
}
_action"
define_method
"append_
#{
callback
}
_filter"
do
|*
names
,
&
blk
|
ActiveSupport
::
Deprecation
.
warn
(
"append_
#{
callback
}
_filter is deprecated and will removed in Rails 5.1. Use append_
#{
callback
}
_action instead."
)
send
(
"append_
#{
callback
}
_action"
,
*
names
,
&
blk
)
end
end
end
end
...
...
actionpack/test/abstract/callbacks_test.rb
浏览文件 @
a74041d4
...
...
@@ -267,9 +267,11 @@ class TestCallbacksWithArgs < ActiveSupport::TestCase
end
class
AliasedCallbacks
<
ControllerWithCallbacks
before_filter
:first
after_filter
:second
around_filter
:aroundz
ActiveSupport
::
Deprecation
.
silence
do
before_filter
:first
after_filter
:second
around_filter
:aroundz
end
def
first
@text
=
"Hello world"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录