Consistently use ActiveRecord / Arel APIs to build SQL queries on cache misses.
More efficient setting of where clause
Add a LIMIT 1 clause for a unique index, and add tests for this
Test fix
Use regexp machters to be resilient against small differences in SQL generation
Regex fixes in tests
Merge pull request #148 from Shopify/use_arel_apis

Consistently use ActiveRecord / Arel APIs to build SQL queries