diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-12-31 21:54:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-31 21:54:20 +0100 |
commit | e632c2fa4cb60072a778ce95c952a0fa95e5b074 (patch) | |
tree | ee120468aa0e7469c9436487a6ae33a0f34dd283 /activerecord/lib | |
parent | 334a7dcf107cd3ff1697163d331d289d6d65dcd7 (diff) | |
parent | d8e5751a1d7ad027519463134fe1a861d02494fc (diff) | |
download | rails-e632c2fa4cb60072a778ce95c952a0fa95e5b074.tar.gz rails-e632c2fa4cb60072a778ce95c952a0fa95e5b074.tar.bz2 rails-e632c2fa4cb60072a778ce95c952a0fa95e5b074.zip |
Merge pull request #27528 from kamipo/extract_casted_booleans
Extract `casted_true`/`casted_false` for `Type::ImmutableString`
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 20 |
1 files changed, 6 insertions, 14 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 1c3d10c15d..97bc5edd4b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -979,22 +979,14 @@ module ActiveRecord end class MysqlString < Type::String # :nodoc: - 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 cast_value(value) - case value - when true then MySQL::Quoting::QUOTED_TRUE - when false then MySQL::Quoting::QUOTED_FALSE - else super - end + def casted_true + MySQL::Quoting::QUOTED_TRUE + end + + def casted_false + MySQL::Quoting::QUOTED_FALSE end end |