I’ve started using the all method instead of find(:all) for fetching records – mainly because it’s shorter to type, but it’s also easy to override with a named scope. Just create a named_scope called all to set whatever default conditions and order you want. You can always use find(:all) if you want the non-scoped records.
named_scope :all, {
:order => 'last_name',
:conditions => 'activated_at IS NOT NULL'
}
Thoughts, corrections and objections welcome in the comments.
Nov 14th, 2008 at 1:43 pm Chris O'Sullivan
Neat idea - I’m using this immediately!