companygardener/lookup_by — pull request #18 by pd (2014-07-06 13:57:23+00:00)
Title: Support Address.where(state: 'TX')

Proof of concept. As best I can tell, the only means of implementing this is to re-open the guts of Rails, which is probably a maintenance nightmare.

* Works on AR 4.1.4, maybe 4.x, likely not 3.2.x. See #17.
* Functionality is limited to `where`, `rewhere`, and `group` for right now.
* No tests on error cases; if `State['TX']` didn't exist, there'd just be a `NoMethodError id on nil` thrown. #15 might help a bit.
* Implementing something like `order` is less obvious: it'll force a join if we really want to order on value.