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.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/type/string.rb b/activemodel/lib/active_model/type/string.rb
new file mode 100644
index 0000000000..8a91410998
--- /dev/null
+++ b/activemodel/lib/active_model/type/string.rb
@@ -0,0 +1,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