Sha256: 2f937462ad675ac546f0a1aacc215c468eb10c84345921c69d3e2b13893843cb
Contents?: true
Size: 721 Bytes
Versions: 11
Compression:
Stored size: 721 Bytes
Contents
class Baza::InfoActiveRecordMysql attr_reader :db def self.connection require "active_record" require "activerecord-jdbc-adapter" if RUBY_PLATFORM == "java" @conn_pool ||= ::ActiveRecord::Base.establish_connection( adapter: "mysql", host: "localhost", database: "baza", username: "build" ) @conn ||= @conn_pool.connection {pool: @conn_pool, conn: @conn} end def initialize(args = {}) data = Baza::InfoActiveRecordMysql.connection data.fetch(:conn).reconnect! @db = Baza::Db.new({ type: :active_record, conn: data.fetch(:conn) }.merge(args)) end def before @db.tables.list(&:drop) end def after @db.close end end
Version data entries
11 entries across 11 versions & 1 rubygems