Learn how to refactor a set of conditional Active Record queries using a Dynamic Delegator.

Read more at the source