instance method
only
Ruby on Rails 4.2.9
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 64
def only(*onlies)
if onlies.any? { |o| o == :where }
onlies << :bind
end
relation_with values.slice(*onlies)
end
Defined in activerecord/lib/active_record/relation/spawn_methods.rb line 64
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::SpawnMethods