Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
8a6f446a
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 搜索 >>
提交
8a6f446a
编写于
9月 26, 2015
作者:
A
amitkumarsuroliya
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix `ActiveRecord::RecordNotFound` error message with custom primary key [ci skip]
上级
7f18ea14
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
7 deletion
+7
-7
activerecord/lib/active_record/associations/collection_proxy.rb
...record/lib/active_record/associations/collection_proxy.rb
+7
-7
未找到文件。
activerecord/lib/active_record/associations/collection_proxy.rb
浏览文件 @
8a6f446a
...
...
@@ -127,7 +127,7 @@ def select(*fields, &block)
# # ]
#
# person.pets.find(1) # => #<Pet id: 1, name: "Fancy-Fancy", person_id: 1>
# person.pets.find(4) # => ActiveRecord::RecordNotFound: Couldn't find Pet with
id
=4
# person.pets.find(4) # => ActiveRecord::RecordNotFound: Couldn't find Pet with
'id'
=4
#
# person.pets.find(2) { |pet| pet.name.downcase! }
# # => #<Pet id: 2, name: "fancy-fancy", person_id: 1>
...
...
@@ -443,7 +443,7 @@ def replace(other_array)
# person.pets.delete_all
#
# Pet.find(1, 2, 3)
# # => ActiveRecord::RecordNotFound
# # => ActiveRecord::RecordNotFound
: Couldn't find all Pets with 'id': (1, 2, 3)
#
# If it is set to <tt>:delete_all</tt>, all the objects are deleted
# *without* calling their +destroy+ method.
...
...
@@ -463,7 +463,7 @@ def replace(other_array)
# person.pets.delete_all
#
# Pet.find(1, 2, 3)
# # => ActiveRecord::RecordNotFound
# # => ActiveRecord::RecordNotFound
: Couldn't find all Pets with 'id': (1, 2, 3)
def
delete_all
(
dependent
=
nil
)
@association
.
delete_all
(
dependent
)
end
...
...
@@ -557,7 +557,7 @@ def destroy_all
# # => [#<Pet id: 2, name: "Spook", person_id: 1>]
#
# Pet.find(1, 3)
# # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
IDs
(1, 3)
# # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
'id':
(1, 3)
#
# If it is set to <tt>:delete_all</tt>, all the +records+ are deleted
# *without* calling their +destroy+ method.
...
...
@@ -585,7 +585,7 @@ def destroy_all
# # ]
#
# Pet.find(1)
# # => ActiveRecord::RecordNotFound: Couldn't find Pet with
id
=1
# # => ActiveRecord::RecordNotFound: Couldn't find Pet with
'id'
=1
#
# You can pass +Fixnum+ or +String+ values, it finds the records
# responding to the +id+ and executes delete on them.
...
...
@@ -649,7 +649,7 @@ def delete(*records)
# person.pets.size # => 0
# person.pets # => []
#
# Pet.find(1, 2, 3) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
IDs
(1, 2, 3)
# Pet.find(1, 2, 3) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
'id':
(1, 2, 3)
#
# You can pass +Fixnum+ or +String+ values, it finds the records
# responding to the +id+ and then deletes them from the database.
...
...
@@ -681,7 +681,7 @@ def delete(*records)
# person.pets.size # => 0
# person.pets # => []
#
# Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
IDs
(4, 5, 6)
# Pet.find(4, 5, 6) # => ActiveRecord::RecordNotFound: Couldn't find all Pets with
'id':
(4, 5, 6)
def
destroy
(
*
records
)
@association
.
destroy
(
*
records
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录