aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-07-06 06:36:10 +0930
committerMatthew Draper <matthew@trebex.net>2014-07-06 06:36:10 +0930
commitacec038b38dc248c5c2f350de69ab89d9b1402c7 (patch)
tree57d11c3bab0f301739c21c7c3cd8c94a266cdc1d
parentc031016558d7be757c9216186670bf3418a1a6ae (diff)
parenta4c26249b1e714e21127ddf26d735a23d52552d1 (diff)
downloadrails-acec038b38dc248c5c2f350de69ab89d9b1402c7.tar.gz
rails-acec038b38dc248c5c2f350de69ab89d9b1402c7.tar.bz2
rails-acec038b38dc248c5c2f350de69ab89d9b1402c7.zip
Merge pull request #16065 from matthewd/mysql-explicit-non-strict
If our connection is explicitly non-strict, tell MySQL
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb4
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