Last Updated: February 25, 2016
·
193
· hotfusionman

Add SQL "LIKE" clauses as ActiveRecord methods in a config/initializers/ file

You can define ActiveRecord 3 / 4 methods that generate LIKE clauses in your SQL rather than writing out those clauses as strings inside your where() calls. Just in case you can't or don't want to use Squeel or similar.

Gist at http://j.mp/1tyamm8 .