Skip to content

Commit bb3ddbf

Browse files
authored
Merge pull request rails#55473 from master-coder-ayush/improve-spawn-methods-documentation
Improve documentation for except and only methods [ci skip]
2 parents 155065e + 63b37eb commit bb3ddbf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

activerecord/lib/active_record/relation/spawn_methods.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ def merge!(other, *rest) # :nodoc:
5252
end
5353
end
5454

55-
# Removes from the query the condition(s) specified in +skips+.
55+
# Removes the condition(s) specified in +skips+ from the query.
5656
#
57-
# Post.order('id asc').except(:order) # discards the order condition
58-
# Post.where('id > 10').order('id asc').except(:where) # discards the where condition but keeps the order
57+
# Post.order('id asc').except(:order) # removes the order condition
58+
# Post.where('id > 10').order('id asc').except(:where) # removes the where condition but keeps the order
5959
def except(*skips)
6060
relation_with values.except(*skips)
6161
end
6262

63-
# Removes any condition from the query other than the one(s) specified in +onlies+.
63+
# Keeps only the condition(s) specified in +onlies+ in the query, removing all others.
6464
#
65-
# Post.order('id asc').only(:where) # discards the order condition
66-
# Post.order('id asc').only(:where, :order) # uses the specified order
65+
# Post.order('id asc').only(:where) # keeps only the where condition, removes the order
66+
# Post.order('id asc').only(:where, :order) # keeps only the where and order conditions
6767
def only(*onlies)
6868
relation_with values.slice(*onlies)
6969
end

0 commit comments

Comments
 (0)