SQL
Database queries become easier to discuss when their purpose is visible in application code. The SQL entry in this collection approaches that idea through named scopes in Rails, rather than through a standalone SQL editor.
The Rails 2.1 named-scope article explains the appeal of giving recurring queries meaningful names. Its code and API references belong to that version; the page is a historical example of query organization.
Give little names to your pet SQL queries with Rails 2.1
A look at named_scope in Rails 2.1 and how named queries improve readability and maintainability.