Here is a talk I gave in 2015 at PDXRuby about using intermediate and advanced SQL within ActiveRecord. It was a bit desultory, but the overall point is that with a good ORM, you can have your cake and eat it too: the ORM gives easy development for simple actions, with access to SQL when you want it. By combining the two, you get better re-usability, code organization, and clarity of intent.

You can view the slides here.

They are built with this git repo.