Sha256: f5445000a8ba8a51a05bef4b43cc41225c1c9a2b1778dd0d5b57b19d30a806f4

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

# encoding: utf-8

# AR adapter for using a fibered mysql2 connection with EM
# This adapter should be used within Thin or Unicorn with the rack-fiber_pool middleware.
# Just update your database.yml's adapter to be 'em_mysql2'

require 'active_record/connection_adapters/abstract_adapter'
require 'active_record/connection_adapters/mysql2_adapter'

module ActiveRecord
  class Base
    def self.em_mysql2_connection(config)
      client = Mysql2::EM::Client.new(config.symbolize_keys)
      options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
      ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-synchrony-1.0.0 lib/em-synchrony/active_record/connection_adapters/em_mysql2_adapter.rb