For a given category, you should be able to get the number of
associated Items with something like the following:
Item.count(["category_id = ?", id])
That's going to trigger a SQL query every time it's called, so if you
have a lot of categories then you might want to use custom SQL to
fetch all the counts at once.