aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-07-16 03:22:36 -0700
committerYves Senn <yves.senn@gmail.com>2013-07-16 03:22:36 -0700
commitcb1d07e43926bcec95cb8b4a663ca9889173395a (patch)
tree0950817d31ee121bd6ca1eb019a0b1a4650d1593 /activerecord/lib
parent754a373e301d2df0b12a11083405252722bc8366 (diff)
parent41bd94b7ef0db484268b8c81de528aedad5ae08d (diff)
downloadrails-cb1d07e43926bcec95cb8b4a663ca9889173395a.tar.gz
rails-cb1d07e43926bcec95cb8b4a663ca9889173395a.tar.bz2
rails-cb1d07e43926bcec95cb8b4a663ca9889173395a.zip
Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting
Fixes AR mysql2 adapter incorrectly casting boolean values
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb6
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql_adapter.rb6
2 files changed, 6 insertions, 6 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 5b25b26164..be42d7e3c6 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -272,6 +272,12 @@ module ActiveRecord
QUOTED_FALSE
end
+ def type_cast(value, column)
+ return super unless value == true || value == false
+
+ value ? 1 : 0
+ end
+
# REFERENTIAL INTEGRITY ====================================
def disable_referential_integrity(&block) #:nodoc:
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
index 1826d88500..be0eb64efd 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -160,12 +160,6 @@ module ActiveRecord
# QUOTING ==================================================
- def type_cast(value, column)
- return super unless value == true || value == false
-
- value ? 1 : 0
- end
-
def quote_string(string) #:nodoc:
@connection.quote(string)
end