diff options
author | Andrey Novikov <envek@envek.name> | 2015-12-27 19:32:31 +0300 |
---|---|---|
committer | Andrey Novikov <envek@envek.name> | 2016-04-18 08:33:40 +0300 |
commit | 1bf9fe75a6473cb7501cae544cab772713e68cef (patch) | |
tree | e611adb4504847c2a1884c1dc86691f6392df4b3 /activesupport/CHANGELOG.md | |
parent | 781271b3b0337241acde6c90bb54ad4cfae389a1 (diff) | |
download | rails-1bf9fe75a6473cb7501cae544cab772713e68cef.tar.gz rails-1bf9fe75a6473cb7501cae544cab772713e68cef.tar.bz2 rails-1bf9fe75a6473cb7501cae544cab772713e68cef.zip |
Change 1.week to create 1 week durations instead of 7 days durations.
This is just to remove astonishment from getting `3600 seconds` from typing `1.hour`.
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 5729a98b99..35fe27fae2 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,25 @@ +* Change `ActiveSupport::Duration` creation with numeric methods like `1.week` + to create durations with more predictable and ISO8601-conformant parts. + + This is to remove astonishment from getting `3600 seconds` from `1.hour`. + + It should not affect current apps as duration's `value` (number of seconds) remains the same, + only hash of `parts` (and `inspect` value) is changed and only when it's constructed by calling + methods on integers. Manual construction of Durations isn't affected. + Inside the ActiveSupport::Duration itself most operations rely only on number of seconds. + + Before: + + [1.hour.inspect, 1.hour.value, 1.hour.parts] # => ["3600 seconds", 3600, [[:seconds, 3600]]] + [1.week.inspect, 1.week.value, 1.week.parts] # => ["7 days", 604800, [[:days, 7]]] + + After: + + [1.hour.inspect, 1.hour.value, 1.hour.parts] # => ["1 hour", 3600, [[:hours, 1]]] + [1.week.inspect, 1.week.value, 1.week.parts] # => ["1 week", 604800, [[:weeks, 1]]] + + *Andrey Novikov* + * Fix behavior of JSON encoding for `Exception`. *namusyaka* |