Wrangle Your SQL With Arel
You wanted to use those fancy Postgres features so you wrote raw SQL. Some time and a few more features go by and now your app is littered with SQL strings. Keep the power and lose the mess by building composable query objects that leverage Arel, the query builder under the hood of ActiveRecord.