Skip to content

Instantly share code, notes, and snippets.

@alvir
Created March 6, 2014 09:36
Show Gist options
  • Save alvir/9386179 to your computer and use it in GitHub Desktop.
Save alvir/9386179 to your computer and use it in GitHub Desktop.
Raw pluck as alternatives pluck
class ActiveRecord::Base
def self.raw_pluck(*args)
sql = connection.unprepared_statement { select(args).to_sql }
connection.execute(sql).to_a
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment