Useful Rails Query

Ruby

Find users with more than 5 posts using ActiveRecord:

`User.joins(:posts).group(:id).having("COUNT(posts.id) > 5")`