aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-02-28 18:19:33 -0500
committerGitHub <noreply@github.com>2017-02-28 18:19:33 -0500
commit77d3550f60a82bc316572026506df4123391d4b5 (patch)
tree786e633b1a900301a24133ed3eb72e8f5dc9a8d2 /activemodel/lib
parent4b4d3f70eb372db6dca60b8a354f4b2cd179055d (diff)
parentb01740f9088be49b49f7ed0ca7b73ebbde87bd97 (diff)
downloadrails-77d3550f60a82bc316572026506df4123391d4b5.tar.gz
rails-77d3550f60a82bc316572026506df4123391d4b5.tar.bz2
rails-77d3550f60a82bc316572026506df4123391d4b5.zip
Merge pull request #25296 from kamipo/use_inspect_for_type_cast_for_schema
Use `inspect` in `type_cast_for_schema` for date/time and decimal values
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/type/date.rb2
-rw-r--r--activemodel/lib/active_model/type/helpers/time_value.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/type/date.rb b/activemodel/lib/active_model/type/date.rb
index 6e313fbca8..eefd080351 100644
--- a/activemodel/lib/active_model/type/date.rb
+++ b/activemodel/lib/active_model/type/date.rb
@@ -12,7 +12,7 @@ module ActiveModel
end
def type_cast_for_schema(value)
- "'#{value.to_s(:db)}'"
+ value.to_s(:db).inspect
end
private
diff --git a/activemodel/lib/active_model/type/helpers/time_value.rb b/activemodel/lib/active_model/type/helpers/time_value.rb
index e57a52104b..53cf7c6029 100644
--- a/activemodel/lib/active_model/type/helpers/time_value.rb
+++ b/activemodel/lib/active_model/type/helpers/time_value.rb
@@ -38,7 +38,7 @@ module ActiveModel
end
def type_cast_for_schema(value)
- "'#{value.to_s(:db)}'"
+ value.to_s(:db).inspect
end
def user_input_in_time_zone(value)