Fix count method to work with select statement.
Add test for pagination with select statement.
Merge pull request #372 from edariedl/fix_count_with_select_statement

Fix count method to work with select statement.
Test against Rails 4.1.2
Merge pull request #394 from zoombody/rails-4.1.2

Test against Rails 4.1.2