I am trying to find the Ruby way to perform this query. I have two objects, `Document` and `Component`. A component `belongs_to` a document and a document can have zero, one or more components. 

What I would like is a count of all documents that have a component. I don't care if the document has just one component or twenty.

What I tried to do was `Component.group(:document_id).count` but that gave me a hash: `{162=>1, 163=>2}` (Document 162 has 1 component, Document 163 has 2).

So basically given this result what I would like the query to return is `2` (docs 162 & 163 being the only documents that have components).