A Matter of Order

Many times we encounter an apparently simple problem: I need this list of items to be ordered by X attribute. How do I do it? Now, for many cases it’s just a matter of sorting or, preferably, adding a call to order in your ActiveRecord query. For example: User . order ( :name ) But, what if I want to order first by a given status, say, a done todo item (yes, that was my actual case), and if the…