Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
993ef9ed
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,发现更多精彩内容 >>
提交
993ef9ed
编写于
7月 16, 2012
作者:
O
Oscar Del Ben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add documentation for query_methods bang methods
上级
37afdef5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
1 deletion
+20
-1
activerecord/lib/active_record/relation/query_methods.rb
activerecord/lib/active_record/relation/query_methods.rb
+20
-1
未找到文件。
activerecord/lib/active_record/relation/query_methods.rb
浏览文件 @
993ef9ed
...
@@ -67,6 +67,7 @@ def includes(*args)
...
@@ -67,6 +67,7 @@ def includes(*args)
args
.
empty?
?
self
:
spawn
.
includes!
(
*
args
)
args
.
empty?
?
self
:
spawn
.
includes!
(
*
args
)
end
end
# Like #includes, but modifies the relation in place.
def
includes!
(
*
args
)
def
includes!
(
*
args
)
args
.
reject!
{
|
a
|
a
.
blank?
}
args
.
reject!
{
|
a
|
a
.
blank?
}
...
@@ -84,6 +85,8 @@ def eager_load(*args)
...
@@ -84,6 +85,8 @@ def eager_load(*args)
args
.
blank?
?
self
:
spawn
.
eager_load!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
eager_load!
(
*
args
)
end
end
# Like #eager_load, but modifies relation in place.
# object.
def
eager_load!
(
*
args
)
def
eager_load!
(
*
args
)
self
.
eager_load_values
+=
args
self
.
eager_load_values
+=
args
self
self
...
@@ -97,6 +100,7 @@ def preload(*args)
...
@@ -97,6 +100,7 @@ def preload(*args)
args
.
blank?
?
self
:
spawn
.
preload!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
preload!
(
*
args
)
end
end
# Like #preload, but modifies relation in place.
def
preload!
(
*
args
)
def
preload!
(
*
args
)
self
.
preload_values
+=
args
self
.
preload_values
+=
args
self
self
...
@@ -114,6 +118,7 @@ def references(*args)
...
@@ -114,6 +118,7 @@ def references(*args)
args
.
blank?
?
self
:
spawn
.
references!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
references!
(
*
args
)
end
end
# Like #references, but modifies relation in place.
def
references!
(
*
args
)
def
references!
(
*
args
)
args
.
flatten!
args
.
flatten!
...
@@ -158,6 +163,7 @@ def select(value = Proc.new)
...
@@ -158,6 +163,7 @@ def select(value = Proc.new)
end
end
end
end
# Like #select, but modifies relation in place.
def
select!
(
value
)
def
select!
(
value
)
self
.
select_values
+=
Array
.
wrap
(
value
)
self
.
select_values
+=
Array
.
wrap
(
value
)
self
self
...
@@ -179,6 +185,7 @@ def group(*args)
...
@@ -179,6 +185,7 @@ def group(*args)
args
.
blank?
?
self
:
spawn
.
group!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
group!
(
*
args
)
end
end
# Like #group, but modifies relation in place.
def
group!
(
*
args
)
def
group!
(
*
args
)
args
.
flatten!
args
.
flatten!
...
@@ -200,6 +207,7 @@ def order(*args)
...
@@ -200,6 +207,7 @@ def order(*args)
args
.
blank?
?
self
:
spawn
.
order!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
order!
(
*
args
)
end
end
# Like #order, but modifies relation in place.
def
order!
(
*
args
)
def
order!
(
*
args
)
args
.
flatten!
args
.
flatten!
...
@@ -224,6 +232,7 @@ def reorder(*args)
...
@@ -224,6 +232,7 @@ def reorder(*args)
args
.
blank?
?
self
:
spawn
.
reorder!
(
*
args
)
args
.
blank?
?
self
:
spawn
.
reorder!
(
*
args
)
end
end
# Like #reorder, but modifies relation in place.
def
reorder!
(
*
args
)
def
reorder!
(
*
args
)
args
.
flatten!
args
.
flatten!
...
@@ -240,6 +249,7 @@ def joins(*args)
...
@@ -240,6 +249,7 @@ def joins(*args)
args
.
compact
.
blank?
?
self
:
spawn
.
joins!
(
*
args
)
args
.
compact
.
blank?
?
self
:
spawn
.
joins!
(
*
args
)
end
end
# Like #joins, but modifies relation in place.
def
joins!
(
*
args
)
def
joins!
(
*
args
)
args
.
flatten!
args
.
flatten!
...
@@ -367,6 +377,7 @@ def having(opts, *rest)
...
@@ -367,6 +377,7 @@ def having(opts, *rest)
opts
.
blank?
?
self
:
spawn
.
having!
(
opts
,
*
rest
)
opts
.
blank?
?
self
:
spawn
.
having!
(
opts
,
*
rest
)
end
end
# Like #having, but modifies relation in place.
def
having!
(
opts
,
*
rest
)
def
having!
(
opts
,
*
rest
)
references!
(
PredicateBuilder
.
references
(
opts
))
if
Hash
===
opts
references!
(
PredicateBuilder
.
references
(
opts
))
if
Hash
===
opts
...
@@ -383,6 +394,7 @@ def limit(value)
...
@@ -383,6 +394,7 @@ def limit(value)
spawn
.
limit!
(
value
)
spawn
.
limit!
(
value
)
end
end
# Like #limit, but modifies relation in place.
def
limit!
(
value
)
def
limit!
(
value
)
self
.
limit_value
=
value
self
.
limit_value
=
value
self
self
...
@@ -399,17 +411,19 @@ def offset(value)
...
@@ -399,17 +411,19 @@ def offset(value)
spawn
.
offset!
(
value
)
spawn
.
offset!
(
value
)
end
end
# Like #offset, but modifies relation in place.
def
offset!
(
value
)
def
offset!
(
value
)
self
.
offset_value
=
value
self
.
offset_value
=
value
self
self
end
end
# Specifies locking settings (default to +true+). For more information
# Specifies locking settings (default to +true+). For more information
# on locking, please see +ActiveRecord::Lockin
+g
.
# on locking, please see +ActiveRecord::Lockin
g+
.
def
lock
(
locks
=
true
)
def
lock
(
locks
=
true
)
spawn
.
lock!
(
locks
)
spawn
.
lock!
(
locks
)
end
end
# Like #lock, but modifies relation in place.
def
lock!
(
locks
=
true
)
def
lock!
(
locks
=
true
)
case
locks
case
locks
when
String
,
TrueClass
,
NilClass
when
String
,
TrueClass
,
NilClass
...
@@ -464,6 +478,7 @@ def readonly(value = true)
...
@@ -464,6 +478,7 @@ def readonly(value = true)
spawn
.
readonly!
(
value
)
spawn
.
readonly!
(
value
)
end
end
# Like #readonly, but modifies relation in place.
def
readonly!
(
value
=
true
)
def
readonly!
(
value
=
true
)
self
.
readonly_value
=
value
self
.
readonly_value
=
value
self
self
...
@@ -513,6 +528,7 @@ def from(value, subquery_name = nil)
...
@@ -513,6 +528,7 @@ def from(value, subquery_name = nil)
spawn
.
from!
(
value
,
subquery_name
)
spawn
.
from!
(
value
,
subquery_name
)
end
end
# Like #from, but modifies relation in place.
def
from!
(
value
,
subquery_name
=
nil
)
def
from!
(
value
,
subquery_name
=
nil
)
self
.
from_value
=
[
value
,
subquery_name
]
self
.
from_value
=
[
value
,
subquery_name
]
self
self
...
@@ -532,6 +548,7 @@ def uniq(value = true)
...
@@ -532,6 +548,7 @@ def uniq(value = true)
spawn
.
uniq!
(
value
)
spawn
.
uniq!
(
value
)
end
end
# Like #uniq, but modifies relation in place.
def
uniq!
(
value
=
true
)
def
uniq!
(
value
=
true
)
self
.
uniq_value
=
value
self
.
uniq_value
=
value
self
self
...
@@ -581,6 +598,7 @@ def extending(*modules, &block)
...
@@ -581,6 +598,7 @@ def extending(*modules, &block)
end
end
end
end
# Like #extending, but modifies relation in place.
def
extending!
(
*
modules
,
&
block
)
def
extending!
(
*
modules
,
&
block
)
modules
<<
Module
.
new
(
&
block
)
if
block_given?
modules
<<
Module
.
new
(
&
block
)
if
block_given?
...
@@ -597,6 +615,7 @@ def reverse_order
...
@@ -597,6 +615,7 @@ def reverse_order
spawn
.
reverse_order!
spawn
.
reverse_order!
end
end
# Like #reverse_order, but modifies relation in place.
def
reverse_order!
def
reverse_order!
self
.
reverse_order_value
=
!
reverse_order_value
self
.
reverse_order_value
=
!
reverse_order_value
self
self
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录