diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 17:49:20 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 17:49:20 -0300 |
commit | e99e23d11561a992c22b711d966ff9a70db0b804 (patch) | |
tree | 74cc2223e00e949c53572d70769e1dd403643d0a /activerecord/lib | |
parent | 492282d20dd3d869fa1ae30f0bce7c93dbba9cb7 (diff) | |
parent | 7e8b06282354da82518f96e0aab38f04788237fa (diff) | |
download | rails-e99e23d11561a992c22b711d966ff9a70db0b804.tar.gz rails-e99e23d11561a992c22b711d966ff9a70db0b804.tar.bz2 rails-e99e23d11561a992c22b711d966ff9a70db0b804.zip |
Merge pull request #14896 from jetthoughts/14895_overide_strict_by_sql_mode
Symbolize variables of mysql/mysql2 connection configuration
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index 75c58ac7d9..ebce0c0460 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -765,22 +765,22 @@ module ActiveRecord end def configure_connection - variables = @config[:variables] || {} + variables = @config.fetch(:variables, {}).stringify_keys # By default, MySQL 'where id is null' selects the last inserted id. # Turn this off. http://dev.rubyonrails.org/ticket/6778 - variables[:sql_auto_is_null] = 0 + variables['sql_auto_is_null'] = 0 # Increase timeout so the server doesn't disconnect us. wait_timeout = @config[:wait_timeout] wait_timeout = 2147483 unless wait_timeout.is_a?(Fixnum) - variables[:wait_timeout] = self.class.type_cast_config_to_integer(wait_timeout) + variables['wait_timeout'] = self.class.type_cast_config_to_integer(wait_timeout) # Make MySQL reject illegal values rather than truncating or blanking them, see # http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables # If the user has provided another value for sql_mode, don't replace it. - if strict_mode? && !variables.has_key?(:sql_mode) - variables[:sql_mode] = 'STRICT_ALL_TABLES' + if strict_mode? && !variables.has_key?('sql_mode') + variables['sql_mode'] = 'STRICT_ALL_TABLES' end # NAMES does not have an equals sign, see |