Skip to content

Instantly share code, notes, and snippets.

View soupmatt's full-sized avatar

Matt Campbell soupmatt

View GitHub Profile
@soupmatt
soupmatt / vcr-webmock-2.rb
Last active May 10, 2018 20:45 — forked from glaszig/vcr-webmock-2.rb
converts vcr cassettes to webmock 2.0-compatible format
# converts URIs in vcr cassettes from uri-based basic auth
# to header-based basic auth to be compatible with webmock 2.0.
# it will create a basic auth header with an ERB tag
# to keep user and password be editable.
#
# Authorization: Basic <%= Base64.encode64("user:password").chomp %>
#
# may not work if using VCR's filter_sensitive_data.
# in that case use https://gist.github.com/ujh/594c99385b6cbe92e32b1bbfa8578a45
#
@soupmatt
soupmatt / patch.rb
Last active August 29, 2015 14:14
Make ActiveRecord 4.1 aware of native postgresql enums
# PostgreSQL enums support (adapted from https://coderwall.com/p/azi3ka)
# Should be fixed in Rails >= 4.2 (https://github.com/rails/rails/pull/13244)
# put this code in an initializer file
raise "Remove this patch!" if Rails.version >= "4.2.0"
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
module OID
class Enum < Type
def type_cast(value)