aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/type/string.rb
blob: 24f9659c7b28a869568546b2117f3315f180783b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module ActiveRecord
  module ConnectionAdapters
    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
end