Change your logic to this:
def search
@products = []
@search = params[:search] && !params[:search].blank? ?
Product.searchlogic(params[:search]) : nil
@products = @search.all unless @search.nil?
end
Granted you could keep your if statement like so:
def search
@products = []
@search = nil
if params[:search] && !params[:search].blank?
Product.searchlogic(params[:search])
end
@products = @search.all unless @search.nil?
end
mway
2010-10-28 21:58:38