diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-01-01 14:34:04 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-01-01 14:34:04 +0100 |
commit | e42cbb7d31db1774d16a158586c5577c7ad1427c (patch) | |
tree | 9b685389fe666d81ada5f63337413c3831ff8594 /activerecord/lib | |
parent | 131d4e8bcb26e142935abdfbb41532eba4e2a2cf (diff) | |
download | rails-e42cbb7d31db1774d16a158586c5577c7ad1427c.tar.gz rails-e42cbb7d31db1774d16a158586c5577c7ad1427c.tar.bz2 rails-e42cbb7d31db1774d16a158586c5577c7ad1427c.zip |
Revert "Merge pull request #27528 from kamipo/extract_casted_booleans"
As pointed out by @matthewd this change makes ImmutableString aware
of MysqlString's existence whereas previously MysqlString was only
overriding public API.
cc @kamipo
This reverts commit e632c2fa4cb60072a778ce95c952a0fa95e5b074, reversing
changes made to 334a7dcf107cd3ff1697163d331d289d6d65dcd7.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 20 |
1 files changed, 14 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 97bc5edd4b..1c3d10c15d 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -979,14 +979,22 @@ module ActiveRecord end class MysqlString < Type::String # :nodoc: - private - - def casted_true - MySQL::Quoting::QUOTED_TRUE + def serialize(value) + case value + when true then MySQL::Quoting::QUOTED_TRUE + when false then MySQL::Quoting::QUOTED_FALSE + else super end + end + + private - def casted_false - MySQL::Quoting::QUOTED_FALSE + def cast_value(value) + case value + when true then MySQL::Quoting::QUOTED_TRUE + when false then MySQL::Quoting::QUOTED_FALSE + else super + end end end |