Person.find_by_sql( "select name, id, body from people" );
But you lose safety (from sql injection) and simplicity of ActiveRecord.
You only lose safety if you're interpolating user-submitted data that you haven't adequately filtered.
So I wonder if there is plugin or a way so you can write the query like this:
Person.find(1, [ 'name', 'id', 'body' ])
Not exactly what you want, but you can do:
id = 1 sql = <<SQL select name, id, body from people where id = :id SQL Person.find_by_sql([sql, { :id => id }]).first
Michael Glaesemann grzm seespotcode net