aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/string.rb
blob: 8a914109981cd48316acb26def45aa29ebb036bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "active_model/type/immutable_string"

module ActiveModel
  module Type
    class String < ImmutableString # :nodoc:
      def changed_in_place?(raw_old_value, new_value)
        if new_value.is_a?(::String)
          raw_old_value != new_value
        end
      end

      private

      def cast_value(value)
        ::String.new(super)
      end
    end
  end
end