The sql generated by the expression is not a valid query, you group by user_id and select many other fields based on this, but do not tell the database how it should collect other files. For example, if your data looks like this:
a | b ---|--- 1 | 1 1 | 2 2 | 3
Now, when you ask db to group by a , and also to return b, it does not know how to aggregate the values 1,2 . You need to specify whether to choose min, max, average, sum or something else. Just as I wrote the answer, there were two answers that could explain all this better.
In your use case, I think you do not want the group to be at the db level. Since there are only 10 arts, you can group them in your application. Do not use this method with thousands of arts, though:
arts = Art.all(:order => "created_at desc", :limit => 10) grouped_arts = arts.group_by {|art| art.user_id}
EDIT: select latest_arts but only one art per user
Just to give you the idea of sql (not tested it since I don't have RDBMS installed on my system)
SELECT arts.* FROM arts WHERE (arts.user_id, arts.created_at) IN (SELECT user_id, MAX(created_at) FROM arts GROUP BY user_id ORDER BY MAX(created_at) DESC LIMIT 10) ORDER BY created_at DESC LIMIT 10
This decision is based on the practical assumption that no two arts for the same user can have the same highest created_at value, but this may be wrong if you import or program the creation of a large number of art objects. If the assumption is not fulfilled, sql may gain more confidence.
EDIT: Attempting to change the request to Arel:
Art.where("(arts.user_id, arts.created_at) IN (SELECT user_id, MAX(created_at) FROM arts GROUP BY user_id ORDER BY MAX(created_at) DESC LIMIT 10)"). order("created_at DESC"). page(params[:page]). per(params[:per])