Sha256: dc29366950a0d876c151bf545387c1548d65fc89073bd47c8f70edcc33f370f4

Contents?: true

Size: 517 Bytes

Versions: 2

Compression:

Stored size: 517 Bytes

Contents

class Baza::Cloner
  def self.from_active_record_connection(connection)
    if connection.class.name.include?('Mysql2Adapter')
      config = connection.instance_variable_get(:@connection).instance_variable_get(:@query_options)

      Baza::Db.new(
        type: :mysql,
        subtype: :mysql2,
        host: config[:host],
        user: config[:username],
        pass: config[:password],
        db: config[:database]
      )
    else
      raise "Unsupported adapter: #{connection.class.name}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baza-0.0.17 include/cloner.rb
baza-0.0.16 include/cloner.rb