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. Come to this talk and learn what Arel is, how to construct complex SQL with Ruby, and how to wrap it all up in model-like classes that play nice with Rails.
Conference organizer: https://railsconf.com/