Bulk deleting / mass modifying users

A potentially more efficient way would be to select the users and delete as one transaction:

User.joins(:user_stat).where("user_stats.post_count = 0 AND user_stats.topic_count = 0").destroy_all

See also:

4 Likes