Regexp SQL finders from Rails
Ever wanted to use regex in your Rails finders? If you’re like me, and versed in regex then you might sometimes do this almost without thinking…
Product.find_by_code /^[NRW][^-]+-[456]/
So, tired of that not actually working, I wrote wherex. It works out of the box with the three primary Rails DBs (SQLite3, MySQL and PostgreSQL) and it’s easy to make any DB with REGEXP support work. I’ve given an example for how to make Oracle work in the wherex docs.
Enjoy.