read model: have `find` return instances of the read model

This updates the newly added read model `find` method to, in addition
to running find on the basic `from` record, use that record data
result to build and return an instance of the read model as its
result.

The previous implementation just blindly returned the result of
the from record's `find` method.  While this result would have all
of the custom select data available, it would be lacking any mixed
in methods that were on the read model.  Plus, it didn't follow the
MR pattern of "get the raw record and create a model/read-model from
it".

This updates the tests for the find to be a little more robust.  They
had no "kind of" test to ensure a read model instance was being
returned.  I added this and the tests still passed.  This was due
to how the tests were stubbing results.  I changed it so that the
stubbed returned result was a fake record instead of a read model
instance.  This is more accurate for what is happening in the code.
Merge pull request #181 from redding/kr-rm-find

read model: have `find` return instances of the read model
version to 0.24.1

* read model: have `find` return instances of the read model #181

/cc @jcredding
Add `<field>_was` methods to models

This adds support for reading previous field values to models.
This is done using ActiveRecord's was methods for its attributes.
When a field is added to a model, it defines `<field>_was` methods
for reading the record's previous value. This also fakes the
behavior with fake records. This allows the method to work with
both real and fake records. This is needed in distributed
programming like running background jobs. If a background job
wants both the value it was before and after a change, then that
has to be provided when the job is enqueued. This allows that.
Merge pull request #183 from redding/jcr-model-field-was

Add `<field>_was` methods to models
version to 0.25.0

* Add `<field>_was` methods to models (#183)

/cc @kellyredding
Add proper unit tests for `ApplyArgs` mixin

This adds proper unit tests for the `ApplyArgs` mixin. This is
setup for making significant changes to the factory logic. This
gets the tests in a good place before I begin reworking the logic.
The previous tests were all system tests and mixed in with the
different factories themselves.
Merge pull request #186 from redding/jcr-cleanup-fac-tests-apply-args

Add proper unit tests for `ApplyArgs` mixin
Add proper unit tests for `ModelFactory` class

This adds proper unit tests for the `ModelFactory` mixin. This is
setup for making significant changes to the factory logic. This
gets the tests in a good place before I begin reworking the logic.
The previous tests were all system tests that are confusing and
hard to follow. This removes many of the old system tests and
only keeps basic usage.
Merge pull request #187 from redding/jcr-cleanup-fac-tests-model-factory

Add proper unit tests for `ModelFactory` class
Support grouped counts with `MR::PagedQuery#total_count`

This updates the `MR::PagedQuery` to work with grouped counts
returned by a relation. The query will sum the values of the
result hash to get the same value as an ungrouped query. This
causes issues with performing proper paging calculations if this
value returns a hash and not an integer.

/cc @kellyredding
version to 0.25.1

* Update `MR::PagedQuery#total_count` to support grouping (d866aa)

/cc @kellyredding
Update query counting, better support grouped queries

This updates MR's query counting to better support grouped
queries. Previously, it would use the hash returned by
ActiveRecord and count the results. This works, but is not
efficient and wasn't well thought out. This updates it to build
a wrapper query that uses the original query as a subquery.
It counts the wrapper query results which are not effected by the
`GROUP BY` statements in the subquery. This is significantly more
efficient than the previous implementation. In a test case, it
reduced the page load time from 11s to 6s. This also changes
`Query#count` not just `PagedQuery#total_count`.

This also updates all query counts to be slightly more efficient
by dropping any custom selects and orders. This doesn't change
much on non-grouped queries, but did speed up the grouped queries
count when a lot of select or order statements were part of the
query.

Finally, this cleaned up the query tests to the latest conventions.
Merge pull request #189 from redding/jcr-better-count

Update query counting, better support grouped queries
version to 0.25.2

* Update query counting, better support grouped queries (#189)

/cc @kellyredding
Add proper unit tests for `ModelStack` class

This adds proper unit tests for the `ModelStack` mixin. This is
setup for making significant changes to the factory logic. This
gets the tests in a good place before I begin reworking the logic.
The previous tests were all system tests that are confusing and
hard to follow. This removes many of the old system tests and
only keeps basic usage.
Merge pull request #190 from redding/jcr-model-stack-unit-tests

Add proper unit tests for `ModelStack` class
Add proper unit tests for `RecordFactory` class

This adds proper unit tests for the `RecordFactory` class. This is
setup for making significant changes to the factory logic. This
gets the tests in a good place before I begin reworking the logic.
The previous tests were all system tests that are confusing and
hard to follow. This removes many of the old system tests and
only keeps basic usage.
Merge pull request #191 from redding/jcr-record-factory-unit-tests

Add proper unit tests for `RecordFactory` class
Add proper unit tests for `RecordStack`

This adds proper unit tests for the `RecordStack` class. This is
setup for making significant changes to the factory logic. This
gets the tests in a good place before I begin reworking the logic.
The previous tests were all system tests that are confusing and
hard to follow. This removes many of the old system tests and
only keeps basic usage.