Skip to content

Commit

Permalink
Cut 2.22.2
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Nov 19, 2023
1 parent 15b97b0 commit afd7bab
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

## master (unreleased)

## 2.22.2 (2023-11-19)

### Bug fixes

* [#1172](https://github.com/rubocop/rubocop-rails/issues/1172): Fix an error for `Rails/UnknownEnv` when using Rails 7.1. ([@koic][])
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: rubocop-rails
title: RuboCop Rails
# We always provide version without patch here (e.g. 1.1),
# as patch versions should not appear in the docs.
version: ~
version: '2.22'
nav:
- modules/ROOT/nav.adoc
15 changes: 11 additions & 4 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ This cop is unsafe because custom `update_attributes` method call was changed to

[source,ruby]
----
#bad
# bad
book.update_attributes!(author: 'Alice')
#good
# good
book.update!(author: 'Alice')
----

Expand Down Expand Up @@ -1841,10 +1841,10 @@ when no output would be produced anyway.

[source,ruby]
----
#bad
# bad
Rails.logger.debug "The time is #{Time.zone.now}."
#good
# good
Rails.logger.debug { "The time is #{Time.zone.now}." }
----

Expand Down Expand Up @@ -4346,6 +4346,13 @@ end

Detect redundant `all` used as a receiver for Active Record query methods.

NOTE: For the methods `delete_all` and `destroy_all`,
this cop will only check cases where the receiver is a model.
It will ignore cases where the receiver is an association (e.g., `user.articles.all.delete_all`).
This is because omitting `all` from an association changes the methods
from `ActiveRecord::Relation` to `ActiveRecord::Associations::CollectionProxy`,
which can affect their behavior.

=== Safety

This cop is unsafe for autocorrection if the receiver for `all` is not an Active Record object.
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module RuboCop
module Rails
# This module holds the RuboCop Rails version information.
module Version
STRING = '2.22.1'
STRING = '2.22.2'

def self.document_version
STRING.match('\d+\.\d+').to_s
Expand Down
12 changes: 12 additions & 0 deletions relnotes/v2.22.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Bug fixes

* [#1172](https://github.com/rubocop/rubocop-rails/issues/1172): Fix an error for `Rails/UnknownEnv` when using Rails 7.1. ([@koic][])
* [#1173](https://github.com/rubocop/rubocop-rails/issues/1173): Fix an error for `Rails/RedundantActiveRecordAllMethod` cop when used with RuboCop 1.51 or lower. ([@koic][])

### Changes

* [#1171](https://github.com/rubocop/rubocop-rails/pull/1171): Change `Rails/RedundantActiveRecordAllMethod` to ignore `delete_all` and `destroy_all` when receiver is an association. ([@masato-bkn][])
* [#1178](https://github.com/rubocop/rubocop-rails/pull/1178): Require RuboCop AST 1.30.0+. ([@koic][])

[@koic]: https://github.com/koic
[@masato-bkn]: https://github.com/masato-bkn

0 comments on commit afd7bab

Please sign in to comment.