You have a typo in the group clause. Should be...
items = Item.joins(:users).group("items.id").select("items.*, count(users.id) as user_count")
You have a typo in the group clause. Should be...
items = Item.joins(:users).group("items.id").select("items.*, count(users.id) as user_count")