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:
posts = Post.where(category = ?, 'somecategory').limit(10)
count = Post.where(category = ?, 'somecategory').count
Edit:
data = Post.find_by_sql(["SELECT count(category) AS total_count, * FROM posts WHERE category = ? GROUP BY posts.id LIMIT 10",'somecategory'])