diff options
Diffstat (limited to 'activerecord/lib/active_record/type/string.rb')
-rw-r--r-- | activerecord/lib/active_record/type/string.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/string.rb b/activerecord/lib/active_record/type/string.rb new file mode 100644 index 0000000000..3b1554bd5a --- /dev/null +++ b/activerecord/lib/active_record/type/string.rb @@ -0,0 +1,23 @@ +module ActiveRecord + module Type + class String < Value # :nodoc: + def type + :string + end + + def text? + true + end + + private + + def cast_value(value) + case value + when true then "1" + when false then "0" + else value.to_s + end + end + end + end +end |