I'm trying to execute some hand-hacked SQL through ActiveRecord::Base.connection
, but for readability and protection against injection, I would like to use placeholders like in this old example: find_by_sql with array format in Rails 3 instead of raw string interpolation.
None of the methods I have found on ActiveRecord::ConnectionAdapters::PostgreSQLAdapter which is the underlying class for connection
appears to support this kind of behavior.
So how can do it? I want the result to be an area of hashes and I don't need to mix it with any existing ActiveRecord scopes.