default the username to 'root' if nothing was specified

This commit is contained in:
Brian Lopez 2010-06-30 10:47:53 -07:00
parent 6ef738200d
commit 40f3a2c491
1 changed files with 1 additions and 0 deletions

View File

@ -5,6 +5,7 @@ require 'mysql2' unless defined? Mysql2
module ActiveRecord
class Base
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
client = Mysql2::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)