SQL92 LIKE expression escaping in Arel's matches(_all) method
Escape some special character in "LIKE" in where-expression with Arel.
When there are some "%" in str in
where(Item.arel_table[:name].matches("%#{str}%"))
"%" in str should be escaped.
The following snipet escapes this kind of special characters by SQL92 convention.
Written by Kazuya Numata
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#