Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

symbolize keys in mysql2_connection sooner #357

Merged
merged 1 commit into from

2 participants

@osheroff

Having troubles with my rails 2.3.x setups and mysql2 -- we're setting the default username to "root" before we symbolize the keys in the hash, so passing in a hash with string keys causes problems.

@brianmario brianmario merged commit dd4b0f8 into brianmario:0.2.x

1 check failed

Details default The Travis build could not complete due to an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 28, 2013
  1. @osheroff

    symbolize keys sooner

    osheroff authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/active_record/connection_adapters/mysql2_adapter.rb
View
4 lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -5,13 +5,15 @@
module ActiveRecord
class Base
def self.mysql2_connection(config)
+ config = config.symbolize_keys
+
config[:username] = 'root' if config[:username].nil?
if Mysql2::Client.const_defined? :FOUND_ROWS
config[:flags] = Mysql2::Client::FOUND_ROWS
end
- client = Mysql2::Client.new(config.symbolize_keys)
+ client = Mysql2::Client.new(config)
options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
ConnectionAdapters::Mysql2Adapter.new(client, logger, options, config)
end
Something went wrong with that request. Please try again.