How can I create an arel query, or even straight sql query, that returns a search term within a string, but only when the term is a single word (and not part of another word).
As seen below, I've tried LIKE
for the search, [[:<:]]
[[:>:]]
to set the word boundary, and %
as wildcards for the rest of the string... though this doesn't work.
Post.where("title LIKE :keyword", {keyword: "%[[:<:]]#{keyword}[[:>:]]%"})
For reference I'm on ruby 2.1, rails 4.