> User.find :all, :joins => "INNER JOIN items ON items.user_id =
> users.id", :select => "users.*, count(items.id) items_count", :group
> => "items.user_id HAVING items_count > 5"
> 
 Try:

User.find :all,
:joins => "INNER JOIN items ON items.user_id = users.id",
:select => "users.*, count(*) items_count",
:group => "items.user_id HAVING items_count > 5"

But it might fail, because I think PostgreSQL expects you to list all 
selected fields in the :group option. First try selecting the user.name 
only and add it to the :group option.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to