> Is it at all possible to construct a query using Datamapper, that allows one
> to use subqueries passed to an order by?
>
> For example:
>
> select
users.id from users order by (select count(*) from mods where
> mods.owner_id =
users.id) asc;
So I converted the query into a left out join and fed it through
find_by_sql (dm-ar-finders) which at least gets me a collection which
is nice:
API::Models::User.find_by_sql(['select
users.id from users left
outer join mods on mods.owner_id =
users.id group by
users.id order by
count(*)'])
But it still means resorting to SQL.
ken.