I currently call find(:all, ...) on one of my models and it return a page of models.
I am now looking at adding a memcached server and want the find(:all..) to only return model ids, the models will be individually retrieved from the cache.
Is this something that ActiveRecord supports or should I write a custom bit of sql?
You can do custom sql, or use the :select option to limit the columns returned:
model.find(:all, :select=>'id') returns an array of models with only the ids loaded
model.find(:all, :select=>'id').collect(&:id) returns an array of ids
if you like using the rest of the find options to help generate your sql for you.
- donald