aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/type/string.rb')
-rw-r--r--activemodel/lib/active_model/type/string.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/type/string.rb b/activemodel/lib/active_model/type/string.rb
index c7e0208a5a..850cab962b 100644
--- a/activemodel/lib/active_model/type/string.rb
+++ b/activemodel/lib/active_model/type/string.rb
@@ -12,7 +12,12 @@ module ActiveModel
private
def cast_value(value)
- ::String.new(super)
+ case value
+ when ::String then ::String.new(value)
+ when true then "t".freeze
+ when false then "f".freeze
+ else value.to_s
+ end
end
end
end