instance method
only
Ruby on Rails 7.1.6
Since v3.0.20Signature
only(*onlies)
Removes any condition from the query other than the one(s) specified in onlies.
Post.order('id asc').only(:where) # discards the order condition Post.order('id asc').only(:where, :order) # uses the specified order
Parameters
-
onliesrest
Source
# File activerecord/lib/active_record/relation/spawn_methods.rb, line 83
def only(*onlies)
relation_with values.slice(*onlies)
end
Defined in activerecord/lib/active_record/relation/spawn_methods.rb line 83
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::SpawnMethods