Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
48663990
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 搜索 >>
提交
48663990
编写于
4月 22, 2014
作者:
L
Lucas Mazza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
`ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
Closes #14841.
上级
d10e2ca9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
2 deletion
+27
-2
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+6
-0
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+1
-1
activerecord/test/cases/timestamp_test.rb
activerecord/test/cases/timestamp_test.rb
+20
-1
未找到文件。
activerecord/CHANGELOG.md
浏览文件 @
48663990
*
`ActiveRecord::Base.no_touching`
no longer triggers callbacks or start empty transactions.
Fixes #14841.
*Lucas Mazza*
*
Fix name collision with
`Array#select!`
with
`Relation#select!`
.
Fixes #14752.
...
...
activerecord/lib/active_record/base.rb
浏览文件 @
48663990
...
...
@@ -296,7 +296,6 @@ class Base
include
Core
include
Persistence
include
NoTouching
include
ReadonlyAttributes
include
ModelSchema
include
Inheritance
...
...
@@ -318,6 +317,7 @@ class Base
include
NestedAttributes
include
Aggregations
include
Transactions
include
NoTouching
include
Reflection
include
Serialization
include
Store
...
...
activerecord/test/cases/timestamp_test.rb
浏览文件 @
48663990
...
...
@@ -112,7 +112,7 @@ def test_touching_many_attributes_updates_them
previous_starting
=
task
.
starting
previous_ending
=
task
.
ending
task
.
touch
(
:starting
,
:ending
)
assert_not_equal
previous_starting
,
task
.
starting
assert_not_equal
previous_ending
,
task
.
ending
assert_in_delta
Time
.
now
,
task
.
starting
,
1
...
...
@@ -170,6 +170,25 @@ def test_no_touching_threadsafe
assert
!
@developer
.
no_touching?
end
def
test_no_touching_with_callbacks
klass
=
Class
.
new
(
ActiveRecord
::
Base
)
do
self
.
table_name
=
"developers"
attr_accessor
:after_touch_called
after_touch
do
|
user
|
user
.
after_touch_called
=
true
end
end
developer
=
klass
.
first
klass
.
no_touching
do
developer
.
touch
assert_not
developer
.
after_touch_called
end
end
def
test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
pet
=
Pet
.
first
owner
=
pet
.
owner
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录