Sequel was created to solve some the problems in previous approaches.
As I've shown, it lets you write your SQL queries in ruby, and translates the ruby code into SQL queries that will work on your database, leading to greater database independence.