I've never been a fan of Rails' hieroglyphics. "The query is the one you’d hope for" - why do we need to "hope", when the ORM could just allow you to use relational concepts directly ? Here is SQLAlchemy's much less exciting version of what I see here for "merge", just use a hybrid (sorry, we have more verbose config, due to explicit is better than implicit): from sqlalchemy import Column, Integer, String, ForeignKey…
There is a database toolkit in ruby-land that allows you do just that! It's called Sequel.
I've built an example, which I deliberately kept as bare-bones and explicit as possible: https://gist.github.com/1aa977a63b7d6a727497
You can also build something similar on top of ARel which backs ActiveRecord.