开发者

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}%")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜