The Category.all.each
Category.find_each is for performance reasons. The former loads all categories in memory while the latrer will do it in batches.
The c.topics.length
Topic.where(category: c).count is probably the same but is more explicit. I like explicit ![]()