aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-12-08 13:04:39 -0500
committerGitHub <noreply@github.com>2016-12-08 13:04:39 -0500
commit55ebf6c1accb8df2db7ab0c76bf3a179f665bb3b (patch)
tree2c40963542baad9df4c2667d68028648618fdb5b /activemodel
parent3f279977ead48ace1acf53567fd258fe140e3b6f (diff)
parent6700f8572615b70ba4ff5e6739a32211fbabed0c (diff)
downloadrails-55ebf6c1accb8df2db7ab0c76bf3a179f665bb3b.tar.gz
rails-55ebf6c1accb8df2db7ab0c76bf3a179f665bb3b.tar.bz2
rails-55ebf6c1accb8df2db7ab0c76bf3a179f665bb3b.zip
Merge pull request #27185 from kamipo/fix_apply_seconds_precision
Fix `apply_seconds_precision` not to be affected by `mathn`
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/type/helpers/time_value.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/type/helpers/time_value.rb b/activemodel/lib/active_model/type/helpers/time_value.rb
index ad78fd49ec..721f9543ed 100644
--- a/activemodel/lib/active_model/type/helpers/time_value.rb
+++ b/activemodel/lib/active_model/type/helpers/time_value.rb
@@ -34,7 +34,7 @@ module ActiveModel
return value unless precision && value.respond_to?(:usec)
number_of_insignificant_digits = 6 - precision
round_power = 10**number_of_insignificant_digits
- value.change(usec: value.usec / round_power * round_power)
+ value.change(usec: value.usec - value.usec % round_power)
end
def type_cast_for_schema(value)