redding/mr — pull request #161 by jcredding (2014-01-07 19:42:07+00:00)
Title: Setup for adding a `find` method to `ReadModel`

This is setup work for adding a `find` method to the `ReadModel`
mixin. This focuses mainly on one issue: the `find` method will
need to be able to choose which types of expressions it wants to
apply to the relation. This wasn't previously possible because all
expressions were grouped in the same collection and because `where`
and `order` expressions were just merges. So this focuses on
splitting up the expressions into seperate collections and adding
a new type of expression, a `MergeQueryExpression`. This class
wraps the `QueryExpression` classes and delegates to them. It has
it's own type (currently `merge`, `where` and `order`) but always
builds a regular query expression with the type `merge`. This is
so when the regular expression is applied, it calls ActiveRecord's
`merge` method.

This also includes cleanups to the `ArgumentError` thrown by the
query configuration methods. The backtrace for the exception was
not getting set properly and was revealing MR internals.