Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
fc6aae34
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,发现更多精彩内容 >>
提交
fc6aae34
编写于
1月 02, 2010
作者:
E
Eloy Duran
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated '_delete' option from NestedAttributes.
上级
a559260e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
19 deletion
+2
-19
activerecord/lib/active_record/nested_attributes.rb
activerecord/lib/active_record/nested_attributes.rb
+2
-13
activerecord/test/cases/nested_attributes_test.rb
activerecord/test/cases/nested_attributes_test.rb
+0
-6
未找到文件。
activerecord/lib/active_record/nested_attributes.rb
浏览文件 @
fc6aae34
...
...
@@ -264,21 +264,11 @@ def _destroy
marked_for_destruction?
end
# Deal with deprecated _delete.
#
def
_delete
#:nodoc:
ActiveSupport
::
Deprecation
.
warn
"_delete is deprecated in nested attributes. Use _destroy instead."
_destroy
end
private
# Attribute hash keys that should not be assigned as normal attributes.
# These hash keys are nested attributes implementation details.
#
# TODO Remove _delete from UNASSIGNABLE_KEYS when deprecation warning are
# removed.
UNASSIGNABLE_KEYS
=
%w( id _destroy _delete )
UNASSIGNABLE_KEYS
=
%w( id _destroy )
# Assigns the given attributes to the association.
#
...
...
@@ -375,8 +365,7 @@ def assign_to_or_mark_for_destruction(record, attributes, allow_destroy)
# Determines if a hash contains a truthy _destroy key.
def
has_destroy_flag?
(
hash
)
ConnectionAdapters
::
Column
.
value_to_boolean
(
hash
[
'_destroy'
])
||
ConnectionAdapters
::
Column
.
value_to_boolean
(
hash
[
'_delete'
])
# TODO Remove after deprecation.
ConnectionAdapters
::
Column
.
value_to_boolean
(
hash
[
'_destroy'
])
end
# Determines if a new record should be build by checking for
...
...
activerecord/test/cases/nested_attributes_test.rb
浏览文件 @
fc6aae34
...
...
@@ -82,12 +82,6 @@ def test_a_model_should_respond_to_underscore_destroy_and_return_if_it_is_marked
assert
ship
.
_destroy
end
def
test_underscore_delete_is_deprecated
ActiveSupport
::
Deprecation
.
expects
(
:warn
)
ship
=
Ship
.
create!
(
:name
=>
'Nights Dirty Lightning'
)
ship
.
_delete
end
def
test_reject_if_method_without_arguments
Pirate
.
accepts_nested_attributes_for
:ship
,
:reject_if
=>
:new_record?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录