I'm trying to enable a search for an item, and then have that item listed if the search is completed. I can get it to work for both instances, but not at the same time. My code:
def search
@results=0
if !params[:searchinput].empty?
@results=1
@searchinput = params[:searchinput]
@searchcriteria="%#{params[:searchinput]}%"
@productlist = Product.where("productname like ? OR description like ?", @searchcriteria)
end
end
I get the following error:
Is the formatting with the productlist statement wrong?
?s, you need to pass@searchcriteriatwice; otherwise it thinks you forgot one.