aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-07-20 18:11:33 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-07-20 18:11:33 +0900
commit03afbc35b6586bd9a3b8b3e9f53d850c9ed49aa7 (patch)
tree79197e04743ed6641738beabfdbade689719127f /activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
parent526d4b8dc816c17e354e2e0243af16d10147c3f0 (diff)
downloadrails-03afbc35b6586bd9a3b8b3e9f53d850c9ed49aa7.tar.gz
rails-03afbc35b6586bd9a3b8b3e9f53d850c9ed49aa7.tar.bz2
rails-03afbc35b6586bd9a3b8b3e9f53d850c9ed49aa7.zip
Use `TRUE` and `FALSE` boolean literals for MySQL
Since #29699, abstract boolean serialization has been changed to use `TRUE` and `FALSE` literals. MySQL also support the literals. So we can use the abstract boolean serialization even for MySQL.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb10
1 files changed, 6 insertions, 4 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 06976aa769..92797fbeef 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "abstract_adapter"
require_relative "statement_pool"
require_relative "mysql/column"
@@ -861,8 +863,8 @@ module ActiveRecord
class MysqlString < Type::String # :nodoc:
def serialize(value)
case value
- when true then MySQL::Quoting::QUOTED_TRUE
- when false then MySQL::Quoting::QUOTED_FALSE
+ when true then "1"
+ when false then "0"
else super
end
end
@@ -871,8 +873,8 @@ module ActiveRecord
def cast_value(value)
case value
- when true then MySQL::Quoting::QUOTED_TRUE
- when false then MySQL::Quoting::QUOTED_FALSE
+ when true then "1"
+ when false then "0"
else super
end
end