Skip to content

Instantly share code, notes, and snippets.

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '6.0.3'
gem 'pg'
GEMFILE
system 'bundle'
end
@rept
rept / raw_sql.rb
Created February 22, 2016 10:25
Adapted raw_sql to do typing.
class RawSQL
include ActiveRecord::ConnectionAdapters::Quoting
def initialize(filename)
@filename = filename
end
def result(params)
pg = ActiveRecord::Base.connection
@type_map ||= PG::BasicTypeMapForResults.new(pg.raw_connection)