Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e216b00a
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,发现更多精彩内容 >>
提交
e216b00a
编写于
9月 21, 2012
作者:
F
Francesco Rodriguez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix AR::Associations::CollectionProxy#delete broken documentation [ci skip]
上级
08035482
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
23 deletion
+2
-23
activerecord/lib/active_record/associations/collection_proxy.rb
...record/lib/active_record/associations/collection_proxy.rb
+2
-23
未找到文件。
activerecord/lib/active_record/associations/collection_proxy.rb
浏览文件 @
e216b00a
...
...
@@ -51,7 +51,6 @@ def loaded?
@association
.
loaded?
end
##
# Works in two ways.
#
# *First:* Specify a subset of fields to be selected from the result set.
...
...
@@ -109,9 +108,8 @@ def select(select = nil, &block)
@association
.
select
(
select
,
&
block
)
end
##
# Finds an object in the collection responding to the +id+. Uses the same
# rules as
+ActiveRecord::Base.find+. Returns +ActiveRecord::RecordNotFound++
# rules as
<tt>ActiveRecord::Base.find</tt>. Returns <tt>ActiveRecord::RecordNotFound</tt>
# error if the object can not be found.
#
# class Person < ActiveRecord::Base
...
...
@@ -140,7 +138,6 @@ def find(*args, &block)
@association
.
find
(
*
args
,
&
block
)
end
##
# Returns the first record, or the first +n+ records, from the collection.
# If the collection is empty, the first form returns +nil+, and the second
# form returns an empty array.
...
...
@@ -171,7 +168,6 @@ def first(*args)
@association
.
first
(
*
args
)
end
##
# Returns the last record, or the last +n+ records, from the collection.
# If the collection is empty, the first form returns +nil+, and the second
# form returns an empty array.
...
...
@@ -202,7 +198,6 @@ def last(*args)
@association
.
last
(
*
args
)
end
##
# Returns a new object of the collection type that has been instantiated
# with +attributes+ and linked to this object, but have not yet been saved.
# You can pass an array of attributes hashes, this will return an array
...
...
@@ -231,7 +226,6 @@ def build(attributes = {}, &block)
@association
.
build
(
attributes
,
&
block
)
end
##
# Returns a new object of the collection type that has been instantiated with
# attributes, linked to this object and that has already been saved (if it
# passes the validations).
...
...
@@ -262,7 +256,6 @@ def create(attributes = {}, &block)
@association
.
create
(
attributes
,
&
block
)
end
##
# Like +create+, except that if the record is invalid, raises an exception.
#
# class Person
...
...
@@ -279,7 +272,6 @@ def create!(attributes = {}, &block)
@association
.
create!
(
attributes
,
&
block
)
end
##
# Add one or more records to the collection by setting their foreign keys
# to the association's primary key. Since << flattens its argument list and
# inserts each record, +push+ and +concat+ behave identically. Returns +self+
...
...
@@ -308,7 +300,6 @@ def concat(*records)
@association
.
concat
(
*
records
)
end
##
# Replace this collection with +other_array+. This will perform a diff
# and delete/add only records that have changed.
#
...
...
@@ -335,7 +326,6 @@ def replace(other_array)
@association
.
replace
(
other_array
)
end
##
# Deletes all the records from the collection. For +has_many+ associations,
# the deletion is done according to the strategy specified by the <tt>:dependent</tt>
# option. Returns an array with the deleted records.
...
...
@@ -428,7 +418,6 @@ def delete_all
@association
.
delete_all
end
##
# Deletes the records of the collection directly from the database.
# This will _always_ remove the records ignoring the +:dependent+
# option.
...
...
@@ -455,7 +444,6 @@ def destroy_all
@association
.
destroy_all
end
##
# Deletes the +records+ supplied and removes them from the collection. For
# +has_many+ associations, the deletion is done according to the strategy
# specified by the <tt>:dependent</tt> option. Returns an array with the
...
...
@@ -519,7 +507,7 @@ def destroy_all
# Pet.find(1, 3)
# # => ActiveRecord::RecordNotFound: Couldn't find all Pets with IDs (1, 3)
#
#
If it is set to <tt>:delete_all</tt>, all the +records+ are deleted
#
If it is set to <tt>:delete_all</tt>, all the +records+ are deleted
# *without* calling their +destroy+ method.
#
# class Person < ActiveRecord::Base
...
...
@@ -574,7 +562,6 @@ def delete(*records)
@association
.
delete
(
*
records
)
end
##
# Destroys the +records+ supplied and removes them from the collection.
# This method will _always_ remove record from the database ignoring
# the +:dependent+ option. Returns an array with the removed records.
...
...
@@ -647,7 +634,6 @@ def destroy(*records)
@association
.
destroy
(
*
records
)
end
##
# Specifies whether the records should be unique or not.
#
# class Person < ActiveRecord::Base
...
...
@@ -666,7 +652,6 @@ def uniq
@association
.
uniq
end
##
# Count all records using SQL.
#
# class Person < ActiveRecord::Base
...
...
@@ -684,7 +669,6 @@ def count(column_name = nil, options = {})
@association
.
count
(
column_name
,
options
)
end
##
# Returns the size of the collection. If the collection hasn't been loaded,
# it executes a <tt>SELECT COUNT(*)</tt> query.
#
...
...
@@ -709,7 +693,6 @@ def size
@association
.
size
end
##
# Returns the size of the collection calling +size+ on the target.
# If the collection has been already loaded, +length+ and +size+ are
# equivalent.
...
...
@@ -733,7 +716,6 @@ def length
@association
.
length
end
##
# Returns +true+ if the collection is empty.
#
# class Person < ActiveRecord::Base
...
...
@@ -751,7 +733,6 @@ def empty?
@association
.
empty?
end
##
# Returns +true+ if the collection is not empty.
#
# class Person < ActiveRecord::Base
...
...
@@ -785,7 +766,6 @@ def any?(&block)
@association
.
any?
(
&
block
)
end
##
# Returns true if the collection has more than one record.
# Equivalent to <tt>collection.size > 1</tt>.
#
...
...
@@ -824,7 +804,6 @@ def many?(&block)
@association
.
many?
(
&
block
)
end
##
# Returns +true+ if the given object is present in the collection.
#
# class Person < ActiveRecord::Base
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录