From 2f0b0743e868df74cb4b003d9a82e4eadc67508d Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 31 Jul 2011 23:50:33 -0400 Subject: [PATCH] throw a search error on user:owns when user owns no items --- app/models/item.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/item.rb b/app/models/item.rb index ff025ad4..c4055588 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -710,6 +710,12 @@ class Item < ActiveRecord::Base # version of Arel, and other conditions will overwrite this one. Since IDs # are guaranteed to be integers, let's just build our own string condition # and be done with it. + + if item_ids.empty? + raise SearchError, "You don't #{ClosetHanger.verb :you, owned_value} " + + "any items yet. Head to Your Items to add some!" + end + "id IN (#{item_ids.join(',')})" end