Search accorss multiple columns?
I followed a railcast to search a single column from a database, which worked fine. Im trying to tweak it to search across multiple columns (first_name AND last_name), but its only searching across last_name , im new to rails, so i feel like i have a simply syntax error (does ||
or?) Any s开发者_StackOverflow社区uggestions? Here's my code.
where('first_name || last_name LIKE ?', "%#{search}%")
where('first_name LIKE ? || last_name LIKE ?', "%#{search}%" , "%#{search}%")
精彩评论