Post.group(:user_id).limit(10)
group_by is not a request method, but an Enumerable method.
In your code, Post.find(:all, :limit => 10) turns into Array before passing group_by . The method above combines query methods and converts them only to Array when you need to use them.
ActiveRecord handles all this. The above method is converted to
SELECT `posts`.* FROM `posts` GROUP BY user_id LIMIT 10
source share