Skip to content

Conversation

mitchej123
Copy link
Contributor

Changes in Rails 4.1 prevents .count from working when you do something like User.select("id, name").count which would generate the SQL: SELECT COUNT(id, name) FROM users; which gives an error.

One work around I found was instead calling User.select("id, name").count(:all) which generates the SQL SELECT COUNT(*) FROM users; which works.

antillas21 added a commit that referenced this pull request Jul 31, 2014
Fix count method to work with select statement for Rails 4.1
@antillas21 antillas21 merged commit c9d040a into jbox-web:master Jul 31, 2014
@antillas21
Copy link
Collaborator

Thanks @mitchej123 for spotting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants