Sha256: 3c1777346dca0078985f803c7477c67abb3a4735e27c9c8189be1c31c29955fb
Contents?: true
Size: 885 Bytes
Versions: 9
Compression:
Stored size: 885 Bytes
Contents
module SchemaMonkey module ActiveRecord module ConnectionAdapters module AbstractAdapter def initialize(*args) dbm = case adapter_name when /^MySQL/i then :Mysql when 'PostgreSQL', 'PostGIS' then :PostgreSQL when 'SQLite' then :SQLite3 end SchemaMonkey.insert(dbm: dbm) super end end end def self.insert(relative_path, mod) class_methods = relative_path.sub!(/::ClassMethods$/, '') base = Module.const_lookup(::ActiveRecord, relative_path) raise InsertionError, "No module ActiveRecord::#{relative_path} to insert #{mod}" unless base Module.insert (class_methods ? base.singleton_class : base), mod mod.extended base if class_methods and mod.respond_to? :extended end end end
Version data entries
9 entries across 9 versions & 1 rubygems