Quick Tip: named_scope
Have you ever found yourself writing queries like this?
User.find(:all, :conditions => ['state = ? AND created_at > ? AND created_at <= ?', 'active', start_date, end_date], :limit => 5)
I suppose you could refactor this into a custom finder that did the heavy lifting for you…
User.find_all_active_in_date_range(start_date, end_date)
But what if you need that same query where the state [...]