Issue #572: grouped count (with aliased columns) issues

ActiveRecord behaves problematically when an attempt is made to 'count' grouped queries. A hash is returned which doesn't contain the length of the returned set of groups, and an exception is thrown if the group clause uses any column aliases.

This is outlined in issue #572

This fix adds specs to highlight the issues and patches the total count functionality used for ActiveRecord. The fix has been tested against Travis for all supported AR versions.

Unfortunately, the desired fix (using Arel) isn't compatible with AR 3.0, so the code falls back to string interpolation in this case. I understand from reading other support tickets that the project collaborators are opposed to string interpolation. I'm happy to start a discussion on how to avoid it.

The current build will fail on Mongoid due to a separate issue, which should have been fixed on the stable branch.