diff options
author | Matthew Draper <matthew@trebex.net> | 2014-07-06 05:40:16 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-07-06 05:49:07 +0930 |
commit | a4c26249b1e714e21127ddf26d735a23d52552d1 (patch) | |
tree | 47eb9da218e6653515348fff8c8ca1377d50d540 /activerecord/lib | |
parent | 3f2ec19c219a55842a1c7f52e3b4b2bf7b5dbb7b (diff) | |
download | rails-a4c26249b1e714e21127ddf26d735a23d52552d1.tar.gz rails-a4c26249b1e714e21127ddf26d735a23d52552d1.tar.bz2 rails-a4c26249b1e714e21127ddf26d735a23d52552d1.zip |
If our connection is explicitly non-strict, tell MySQL
We default to making the connection strict, but have historically relied
on the MySQL default when we want it to be non-strict. On some (recent?)
versions of MySQL, new connections default to being strict, so if we've
been told 'strict:false', we're obliged to pass that on.
This fixes a test failure that we've seen turn up on relatively-new
development machines, so we do already have a test covering it.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 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 e4a6f43225..ccb957d2c8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -793,8 +793,8 @@ module ActiveRecord # 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' + unless variables.has_key?('sql_mode') + variables['sql_mode'] = strict_mode? ? 'STRICT_ALL_TABLES' : '' end # NAMES does not have an equals sign, see |