I wonder if there is Rails magic to avoid searching the database twice in the following situation:
Background: I am searching for orders from a user which are either PENDING or SENT and due today.
Here is the pseudo code:
order_array = Order.where(:filled => pending) || Order.where(:fileld => done, :due => today)
Now the problem is that this searches the database twice. I’d like to do this in one search and would appreciate pointers into how RoR would do it.
I think this is what you are looking for: