Sha256: 3b6350fec19efe9e6128d2dbeebe995a2a525406ff8bd60184557adc46abee1d
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module FreshConnection module Extend module ArResolver def spec(*args) specification = super case specification.config[:adapter].to_s when "mysql", "mysql2" require 'fresh_connection/extend/adapters/m2_adapter' __extend_adapter_by_fc(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, M2Adapter) when "postgresql" require 'fresh_connection/extend/adapters/pg_adapter' __extend_adapter_by_fc(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, PgAdapter) else raise NotImplementedError, "This adapter('#{specification.config[:adapter]}') is not supported. If you specified the mysql or postgres adapter, it's probably a bug in FreshConnection. Please teach me (https://github.com/tsukasaoishi/fresh_connection/issues/new)" end specification end def __extend_adapter_by_fc(klass, extend_adapter) return if klass.include?(extend_adapter) klass.prepend BaseAdapter klass.prepend extend_adapter end end end end
Version data entries
6 entries across 6 versions & 1 rubygems