rails/guides
Andrey Novikov cb9d0e4864
Fix inconsistent results when parsing large durations and constructing durations from code
ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true

Duration parsing made independent from any moment of time:
Fixed length in seconds is assigned to each duration part during parsing.

Changed duration of months and years in seconds to more accurate and logical:

 1. The value of 365.2425 days in Gregorian year is more accurate
    as it accounts for every 400th non-leap year.

 2. Month's length is bound to year's duration, which makes
    sensible comparisons like `12.months == 1.year` to be `true`
    and nonsensical ones like `30.days == 1.month` to be `false`.

Calculations on times and dates with durations shouldn't be affected as
duration's numeric value isn't used in calculations, only parts are used.

Methods on `Numeric` like `2.days` now use these predefined durations
to avoid duplicating of duration constants through the codebase and
eliminate creation of intermediate durations.
2017-01-09 23:04:48 +03:00
..
assets Merge pull request #27143 from sachin21/fix-permission 2016-11-22 21:51:56 +10:30
bug_report_templates Remove deprecated support to passing a column to #quote 2016-12-29 17:53:03 -05:00
rails_guides Fix Rubocop violations and fix documentation visibility 2016-12-28 21:53:51 -05:00
source Fix inconsistent results when parsing large durations and constructing durations from code 2017-01-09 23:04:48 +03:00
.document adds guides/.document to tell rdoc not to process this directory 2013-03-04 22:28:23 +01:00
CHANGELOG.md Start Rails 5.1 development 🎉 2016-05-10 03:46:56 -03:00
rails_guides.rb applies new string literal convention in guides 2016-08-06 19:21:59 +02:00
Rakefile Fix Rubocop violations and fix documentation visibility 2016-12-28 21:53:51 -05:00
w3c_validator.rb Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00