Rails, SQL - perform a Count and Select in a single query
<p>Is there a way to do a single query to do both a select and a count, and get back an array with the two values? For example:</p>

<pre><code>posts = Post.where(category = ?, 'somecategory').limit(10)
count = Post.where(category = ?, 'somecategory').count
</code></pre>

<p>Edit:</p>

<pre><code>data = Post.find_by_sql(["SELECT count(category) AS total_count, * FROM posts WHERE category = ? GROUP BY posts.id LIMIT 10",'somecategory'])
</code></pre>