instance method
only
Ruby on Rails edge
Since v3.0.20Signature
only(*onlies)
Keeps only the condition(s) specified in onlies in the query, removing all others.
“‘ Post.order(’id asc’).only(:where) # keeps only the where condition, removes the order Post.order(‘id asc’).only(:where, :order) # keeps only the where and order conditions “‘
Parameters
-
onliesrest
Source
# File activerecord/lib/active_record/relation/spawn_methods.rb, line 75
def only(*onlies)
relation_with @values.slice(*onlies)
end
Defined in activerecord/lib/active_record/relation/spawn_methods.rb line 75
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::SpawnMethods