Sha256: 53a11bd5d542e5543252664cfd3d03635cb8388729eb4b96d09b2af2395882f7
Contents?: true
Size: 916 Bytes
Versions: 2
Compression:
Stored size: 916 Bytes
Contents
# frozen_string_literal: true 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
schema_monkey-3.0.2 | lib/schema_monkey/active_record.rb |
schema_monkey-3.0.2.beta.1 | lib/schema_monkey/active_record.rb |