I am following Railscast for adding search, sorting and pagination in my application. I changed my search logic in the column search model (description and name). It seems to work. I also modified it to look for case insensitive. This seems to work fine in my local application, but when I click on the hero I can only search for lowercase letters. A search with any uppercase letters does not return results at all, even if the case matches the results.
here is the code in my model:
def self.search(search)
if search
where('LOWER (description) LIKE ? OR LOWER (title) LIKE ?', "%#{search}%" , "%#{search}%")
else
scoped
end
end
source
share