Topic: Advanced Query.. help pls

I have a query in my code, that someone from this forum graciously helped me with in the past, that i now need further help with

I have a User model and an Event model
user has_many :events

the query below finds all users who have more events than the number specified by 'my_number'

users =, :joins => :events).select {|u| > (my_number)}

This query is working great. But i want to be able to :order_by the amount events that the returned users have.. so far i can't get the syntax right.. any help would be apprecated.

its rails 2.3.8 too