I'd like to try and revive discussion around these issues:

https://github.com/rails/rails/issues/7121
https://github.com/rails/arel/issues/83

Originally, my thought for an easy solution was to hide the presence of 
group_values inside a subquery using `from(relation.group(x)).count` as I 
suggested here:

https://groups.google.com/forum/#!topic/rubyonrails-core/mwBehQcEduU

SELECT COUNT(*) FROM (SELECT * FROM ... GROUP BY ...)

Unfortunately some databases (MySQL) are really inefficient at dealing with 
functions on subqueries like this. And ultimately, relying on subqueries to 
fix it for us is a hack just to get around the problem with blindly calling 
`count` and expecting an integer. I keep running into this problem 
regularly enough that I really want to work something out for separate and 
predictable "row count" and "grouped count" methods. Maybe something like 
one of these ideas I sketched out:

https://gist.github.com/avit/3681183 

Is there a way forward?

Andrew Vit

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to