Rails/Arel: Selecting all records as an ActiveRecord::Relation
Using Arel in Rails - I'm looking for a way of creating an ActiveRecord::Relation that effectively results in SELECT * FROM table , which I can still manipulate further. For example, I have a model that's split up into multiple categories, and I return counts for these in the following manner: relation = Model.where(:archived => false) # all non-archived records record_counts = { :total => relation.count, :for_sale => relation.where(:for_sale => true).count :on_auction => relation.where(:on_auction => true).count } This works fine, and has the advantage of firing off COUNT queries to MySQL,