aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-01-01 14:34:04 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2017-01-01 14:34:04 +0100
commite42cbb7d31db1774d16a158586c5577c7ad1427c (patch)
tree9b685389fe666d81ada5f63337413c3831ff8594 /activemodel
parent131d4e8bcb26e142935abdfbb41532eba4e2a2cf (diff)
downloadrails-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 'activemodel')
-rw-r--r--activemodel/lib/active_model/type/immutable_string.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/activemodel/lib/active_model/type/immutable_string.rb b/activemodel/lib/active_model/type/immutable_string.rb
index c967d428ac..58268540e5 100644
--- a/activemodel/lib/active_model/type/immutable_string.rb
+++ b/activemodel/lib/active_model/type/immutable_string.rb
@@ -8,8 +8,8 @@ module ActiveModel
def serialize(value)
case value
when ::Numeric, ActiveSupport::Duration then value.to_s
- when true then casted_true
- when false then casted_false
+ when true then "t"
+ when false then "f"
else super
end
end
@@ -19,20 +19,12 @@ module ActiveModel
def cast_value(value)
result = \
case value
- when true then casted_true
- when false then casted_false
+ when true then "t"
+ when false then "f"
else value.to_s
end
result.freeze
end
-
- def casted_true
- "t".freeze
- end
-
- def casted_false
- "f".freeze
- end
end
end
end