It would perform better to do: stock_items.where('count_on_hand > 0').size > 0