only(*onlies) public

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
Show source
Register or log in to add new notes.