Essential RubyOnRails Patterns — Part 2: Query Objects
Query Objects (also referred to as queries) is another pattern that helps in decomposing your fat ActiveRecord models and keeping your code both slim and readable. While this article is written with Ruby On Rails in mind, it easily applies to other frameworks, especially MVC based and applying ActiveRecord pattern.