diff --git a/CHANGELOG.md b/CHANGELOG.md index 712648539f..e77a8956d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * [#416](https://github.com/rubocop/rubocop-rails/pull/416): Make `Rails/HasManyOrHasOneDependent` accept combination of association extension and `with_options`. ([@ohbarye][]) * [#432](https://github.com/rubocop/rubocop-rails/issues/432): Exclude gemspec file by default for `Rails/TimeZone` cop. ([@koic][]) * [#440](https://github.com/rubocop/rubocop-rails/issues/440): This PR makes `Rails/TimeZone` aware of timezone specifier. ([@koic][]) +* [#381](https://github.com/rubocop/rubocop-rails/pull/381): Update `IgnoredMethods` list for `Lint/NumberConversion` to allow Rails' duration methods. ([@dvandersluis][]) ## 2.9.1 (2020-12-16) diff --git a/config/default.yml b/config/default.yml index 5cbac2ecbe..a8311ac9dd 100644 --- a/config/default.yml +++ b/config/default.yml @@ -17,6 +17,27 @@ AllCops: # as the default. TargetRailsVersion: ~ +Lint/NumberConversion: + # Add Rails' duration methods to the ignore list for `Lint/NumberConversion` + # so that calling `to_i` on one of these does not register an offense. + # See: https://github.com/rubocop/rubocop/issues/8950 + IgnoredMethods: + - ago + - from_now + - second + - seconds + - minute + - minutes + - hour + - hours + - day + - days + - week + - weeks + - fortnight + - fortnights + - in_milliseconds + Rails/ActionFilter: Description: 'Enforces consistent use of action filter methods.' Enabled: true