Sha256: 3eb2707e56fe68f831de1c0c0d50e94e4bc866f46ce7dfd67af866f599fb5841
Contents?: true
Size: 929 Bytes
Versions: 15
Compression:
Stored size: 929 Bytes
Contents
class Baza::Cloner def self.from_active_record_connection(connection) if connection.class.name.include?("Mysql2Adapter") connection = connection.instance_variable_get(:@connection) config = connection.instance_variable_get(:@query_options) config ||= connection.instance_variable_get(:@config) db_args = { type: :mysql2, host: config[:host], user: config[:username], pass: config[:password], db: config[:database] } Baza::Db.new(db_args) elsif connection.class.name.include?("MysqlAdapter") connection = connection.instance_variable_get(:@connection) connection = connection.instance_variable_get(:@connection) if RUBY_PLATFORM == "java" db_args = { type: :mysql, conn: connection } Baza::Db.new(db_args) else raise "Unsupported adapter: #{connection.class.name}" end end end
Version data entries
15 entries across 15 versions & 1 rubygems