aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2018-03-11 18:19:20 +0000
committerAndrew White <andrew.white@unboxed.co>2018-03-11 18:19:20 +0000
commit4d9126cfccefdb69149caf7681d674b50335e9b4 (patch)
treebcc04a54333c7739820594ef682ee34ef77644e8 /activemodel
parent38c7ddd4e9f3f22f67d9615dd04a2ae9525824fb (diff)
downloadrails-4d9126cfccefdb69149caf7681d674b50335e9b4.tar.gz
rails-4d9126cfccefdb69149caf7681d674b50335e9b4.tar.bz2
rails-4d9126cfccefdb69149caf7681d674b50335e9b4.zip
Apply time column precision on assignment
In #20317, datetime columns had their precision applied on assignment but that behaviour wasn't applied to time columns - this commit fixes that. Fixes #30301.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/type/time.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/type/time.rb b/activemodel/lib/active_model/type/time.rb
index ad7ba0351a..8e939ac00a 100644
--- a/activemodel/lib/active_model/type/time.rb
+++ b/activemodel/lib/active_model/type/time.rb
@@ -28,7 +28,7 @@ module ActiveModel
private
def cast_value(value)
- return value unless value.is_a?(::String)
+ return apply_seconds_precision(value) unless value.is_a?(::String)
return if value.empty?
if value.start_with?("2000-01-01")