Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
57bc25c5
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 搜索 >>
提交
57bc25c5
编写于
1月 09, 2011
作者:
J
John Firebaugh
提交者:
Santiago Pastorino
1月 31, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
Signed-off-by:
N
Santiago Pastorino
<
santiago@wyeworks.com
>
上级
9666b6a6
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
28 addition
and
31 deletion
+28
-31
actionpack/lib/action_dispatch/middleware/callbacks.rb
actionpack/lib/action_dispatch/middleware/callbacks.rb
+1
-1
actionpack/lib/action_dispatch/middleware/reloader.rb
actionpack/lib/action_dispatch/middleware/reloader.rb
+4
-4
activemodel/README.rdoc
activemodel/README.rdoc
+1
-1
activemodel/lib/active_model/callbacks.rb
activemodel/lib/active_model/callbacks.rb
+1
-4
activemodel/lib/active_model/validations.rb
activemodel/lib/active_model/validations.rb
+1
-1
activemodel/lib/active_model/validations/callbacks.rb
activemodel/lib/active_model/validations/callbacks.rb
+1
-1
activemodel/test/cases/callbacks_test.rb
activemodel/test/cases/callbacks_test.rb
+2
-2
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+3
-3
activerecord/lib/active_record/callbacks.rb
activerecord/lib/active_record/callbacks.rb
+5
-5
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
...ve_record/connection_adapters/abstract/connection_pool.rb
+1
-1
activerecord/lib/active_record/transactions.rb
activerecord/lib/active_record/transactions.rb
+2
-2
activesupport/lib/active_support/testing/setup_and_teardown.rb
...esupport/lib/active_support/testing/setup_and_teardown.rb
+4
-4
activesupport/test/callback_inheritance_test.rb
activesupport/test/callback_inheritance_test.rb
+1
-1
activesupport/test/callbacks_test.rb
activesupport/test/callbacks_test.rb
+1
-1
未找到文件。
actionpack/lib/action_dispatch/middleware/callbacks.rb
浏览文件 @
57bc25c5
...
...
@@ -25,7 +25,7 @@ def initialize(app, unused = nil)
end
def
call
(
env
)
_run_call_callbacks
do
run_callbacks
:call
do
@app
.
call
(
env
)
end
end
...
...
actionpack/lib/action_dispatch/middleware/reloader.rb
浏览文件 @
57bc25c5
...
...
@@ -43,12 +43,12 @@ def self.to_cleanup(*args, &block)
# Execute all prepare callbacks.
def
self
.
prepare!
new
(
nil
).
send
(
:_run_prepare_callbacks
)
new
(
nil
).
run_callbacks
:prepare
end
# Execute all cleanup callbacks.
def
self
.
cleanup!
new
(
nil
).
send
(
:_run_cleanup_callbacks
)
new
(
nil
).
run_callbacks
:cleanup
end
def
initialize
(
app
)
...
...
@@ -64,12 +64,12 @@ def close
end
def
call
(
env
)
_run_prepare_callbacks
run_callbacks
:prepare
response
=
@app
.
call
(
env
)
response
[
2
].
extend
(
CleanupOnClose
)
response
rescue
Exception
_run_cleanup_callbacks
run_callbacks
:cleanup
raise
end
end
...
...
activemodel/README.rdoc
浏览文件 @
57bc25c5
...
...
@@ -41,7 +41,7 @@ modules:
define_model_callbacks :create
def create
_run_create_callbacks
do
run_callbacks :create
do
# Your create action methods here
end
end
...
...
activemodel/lib/active_model/callbacks.rb
浏览文件 @
57bc25c5
...
...
@@ -24,14 +24,11 @@ module ActiveModel
# you want callbacks on in a block so that the callbacks get a chance to fire:
#
# def create
#
_run_create_callbacks
do
#
run_callbacks :create
do
# # Your create action methods here
# end
# end
#
# The _run_<method_name>_callbacks methods are dynamically created when you extend
# the <tt>ActiveModel::Callbacks</tt> module.
#
# Then in your class, you can use the +before_create+, +after_create+ and +around_create+
# methods, just as you would in an Active Record module.
#
...
...
activemodel/lib/active_model/validations.rb
浏览文件 @
57bc25c5
...
...
@@ -207,7 +207,7 @@ def invalid?(context = nil)
protected
def
run_validations!
_run_validate_callbacks
run_callbacks
:validate
errors
.
empty?
end
end
...
...
activemodel/lib/active_model/validations/callbacks.rb
浏览文件 @
57bc25c5
...
...
@@ -50,7 +50,7 @@ def after_validation(*args, &block)
# Overwrite run validations to include callbacks.
def
run_validations!
_run_validation_callbacks
{
super
}
run_callbacks
(
:validation
)
{
super
}
end
end
end
...
...
activemodel/test/cases/callbacks_test.rb
浏览文件 @
57bc25c5
...
...
@@ -37,7 +37,7 @@ def before_create
end
def
create
_run_create_callbacks
do
run_callbacks
:create
do
@callbacks
<<
:create
@valid
end
...
...
@@ -92,7 +92,7 @@ def initialize
def
callback1
;
self
.
history
<<
'callback1'
;
end
def
callback2
;
self
.
history
<<
'callback2'
;
end
def
create
_run_create_callbacks
{}
run_callbacks
(
:create
)
{}
self
end
end
...
...
activerecord/lib/active_record/base.rb
浏览文件 @
57bc25c5
...
...
@@ -1400,7 +1400,7 @@ def initialize(attributes = nil)
self
.
attributes
=
attributes
unless
attributes
.
nil?
result
=
yield
self
if
block_given?
_run_initialize_callbacks
run_callbacks
:initialize
result
end
...
...
@@ -1437,8 +1437,8 @@ def init_with(coder)
@aggregation_cache
=
{}
@readonly
=
@destroyed
=
@marked_for_destruction
=
false
@new_record
=
false
_run_find_callbacks
_run_initialize_callbacks
run_callbacks
:find
run_callbacks
:initialize
end
# Specifies how the record is dumped by +Marshal+.
...
...
activerecord/lib/active_record/callbacks.rb
浏览文件 @
57bc25c5
...
...
@@ -237,25 +237,25 @@ module Callbacks
end
def
destroy
#:nodoc:
_run_destroy_callbacks
{
super
}
run_callbacks
(
:destroy
)
{
super
}
end
def
touch
(
*
)
#:nodoc:
_run_touch_callbacks
{
super
}
run_callbacks
(
:touch
)
{
super
}
end
private
def
create_or_update
#:nodoc:
_run_save_callbacks
{
super
}
run_callbacks
(
:save
)
{
super
}
end
def
create
#:nodoc:
_run_create_callbacks
{
super
}
run_callbacks
(
:create
)
{
super
}
end
def
update
(
*
)
#:nodoc:
_run_update_callbacks
{
super
}
run_callbacks
(
:update
)
{
super
}
end
end
end
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
浏览文件 @
57bc25c5
...
...
@@ -212,7 +212,7 @@ def checkout
# calling +checkout+ on this pool.
def
checkin
(
conn
)
@connection_mutex
.
synchronize
do
conn
.
send
(
:_run_checkin_callbacks
)
do
conn
.
run_callbacks
:checkin
do
@checked_out
.
delete
conn
@queue
.
signal
end
...
...
activerecord/lib/active_record/transactions.rb
浏览文件 @
57bc25c5
...
...
@@ -259,7 +259,7 @@ def rollback_active_record_state!
# Call the after_commit callbacks
def
committed!
#:nodoc:
_run_commit_callbacks
run_callbacks
:commit
ensure
clear_transaction_record_state
end
...
...
@@ -267,7 +267,7 @@ def committed! #:nodoc:
# Call the after rollback callbacks. The restore_state argument indicates if the record
# state should be rolled back to the beginning or just to the last savepoint.
def
rolledback!
(
force_restore_state
=
false
)
#:nodoc:
_run_rollback_callbacks
run_callbacks
:rollback
ensure
restore_transaction_record_state
(
force_restore_state
)
end
...
...
activesupport/lib/active_support/testing/setup_and_teardown.rb
浏览文件 @
57bc25c5
...
...
@@ -31,14 +31,14 @@ module ForMiniTest
def
run
(
runner
)
result
=
'.'
begin
_run_setup_callbacks
do
run_callbacks
:setup
do
result
=
super
end
rescue
Exception
=>
e
result
=
runner
.
puke
(
self
.
class
,
method_name
,
e
)
ensure
begin
_run_teardown_callbacks
run_callbacks
:teardown
rescue
Exception
=>
e
result
=
runner
.
puke
(
self
.
class
,
method_name
,
e
)
end
...
...
@@ -62,7 +62,7 @@ def run(result)
begin
begin
_run_setup_callbacks
do
run_callbacks
:setup
do
setup
__send__
(
@method_name
)
mocha_verify
(
mocha_counter
)
if
mocha_counter
...
...
@@ -77,7 +77,7 @@ def run(result)
ensure
begin
teardown
_run_teardown_callbacks
run_callbacks
:teardown
rescue
Test
::
Unit
::
AssertionFailedError
=>
e
add_failure
(
e
.
message
,
e
.
backtrace
)
rescue
Exception
=>
e
...
...
activesupport/test/callback_inheritance_test.rb
浏览文件 @
57bc25c5
...
...
@@ -70,7 +70,7 @@ def perform!
end
def
dispatch
_run_dispatch_callbacks
run_callbacks
:dispatch
self
end
end
...
...
activesupport/test/callbacks_test.rb
浏览文件 @
57bc25c5
...
...
@@ -14,7 +14,7 @@ def before_save1; self.history << :before; end
def
after_save1
;
self
.
history
<<
:after
;
end
def
save
self
.
send
(
:_run_save_callbacks
)
do
run_callbacks
:save
do
raise
'boom'
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录