Skip to content

Commit fcc4cf6

Browse files
committed
Cut 2.28.0
1 parent bac0f3e commit fcc4cf6

File tree

5 files changed

+45
-6
lines changed

5 files changed

+45
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
## master (unreleased)
1111

12+
## 2.28.0 (2024-12-25)
13+
1214
### New features
1315

1416
* [#1383](https://github.com/rubocop/rubocop-rails/pull/1383): Introduce `AllCops: MigratedSchemaVersion` config. ([@koic][])

docs/antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop-rails
22
title: RuboCop Rails
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: ~
5+
version: '2.28'
66
nav:
77
- modules/ROOT/nav.adoc

docs/modules/ROOT/pages/cops_rails.adoc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ enum status: { active: 0, archived: 1 }
20752075
[#railsenumsyntax]
20762076
== Rails/EnumSyntax
20772077
2078-
NOTE: Required Ruby version: 3.0
2078+
NOTE: Requires Ruby version 3.0
20792079
20802080
NOTE: Required Rails version: 7.0
20812081
@@ -4324,6 +4324,24 @@ Enforces the use of `pluck` over `map`.
43244324
element in an enumerable. When called on an Active Record relation, it
43254325
results in a more efficient query that only selects the necessary key.
43264326
4327+
NOTE: If the receiver's relation is not loaded and `pluck` is used inside an iteration,
4328+
it may result in N+1 queries because `pluck` queries the database on each iteration.
4329+
This cop ignores offenses for `map/collect` when they are suspected to be part of an iteration
4330+
to prevent such potential issues.
4331+
4332+
[source,ruby]
4333+
----
4334+
users = User.all
4335+
5.times do
4336+
users.map { |user| user[:foo] } # Only one query is executed
4337+
end
4338+
4339+
users = User.all
4340+
5.times do
4341+
users.pluck(:id) # A query is executed on every iteration
4342+
end
4343+
----
4344+
43274345
[#safety-railspluck]
43284346
=== Safety
43294347
@@ -5928,7 +5946,7 @@ Rails.public_path.join('file.pdf')
59285946
[#railssafenavigation]
59295947
== Rails/SafeNavigation
59305948
5931-
NOTE: Required Ruby version: 2.3
5949+
NOTE: Requires Ruby version 2.3
59325950
59335951
|===
59345952
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
@@ -6544,7 +6562,7 @@ SQL
65446562
[#railsstripheredoc]
65456563
== Rails/StripHeredoc
65466564
6547-
NOTE: Required Ruby version: 2.3
6565+
NOTE: Requires Ruby version 2.3
65486566
65496567
|===
65506568
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
@@ -7670,7 +7688,7 @@ User.where.not('trashed = ? OR role = ?', true, 'admin')
76707688
[#railswhererange]
76717689
== Rails/WhereRange
76727690
7673-
NOTE: Required Ruby version: 2.6
7691+
NOTE: Requires Ruby version 2.6
76747692
76757693
NOTE: Required Rails version: 6.0
76767694

lib/rubocop/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
module Rails
55
# This module holds the RuboCop Rails version information.
66
module Version
7-
STRING = '2.27.0'
7+
STRING = '2.28.0'
88

99
def self.document_version
1010
STRING.match('\d+\.\d+').to_s

relnotes/v2.28.0.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### New features
2+
3+
* [#1383](https://github.com/rubocop/rubocop-rails/pull/1383): Introduce `AllCops: MigratedSchemaVersion` config. ([@koic][])
4+
5+
### Bug fixes
6+
7+
* [#1390](https://github.com/rubocop/rubocop-rails/pull/1390): Fix an incorrect autocorrect for `Rails/SelectMap` when `select` has no receiver and method chains are used. ([@masato-bkn][])
8+
* [#1382](https://github.com/rubocop/rubocop-rails/pull/1382): Fix false negatives for `Rails/RedundantActiveRecordAllMethod` when using `all` method in block. ([@masato-bkn][])
9+
* [#1397](https://github.com/rubocop/rubocop-rails/pull/1397): Fix `Rails/FilePath` cop error on `join` method with implicit receiver. ([@viralpraxis][])
10+
* [#1398](https://github.com/rubocop/rubocop-rails/pull/1398): Fix `Rails/FilePath` cop error in case of extra operations in `Rails.root` interpolation. ([@viralpraxis][])
11+
* [#1392](https://github.com/rubocop/rubocop-rails/pull/1392): Fix `Rails/FilePath` cop error with rescued `Rails.root`. ([@viralpraxis][])
12+
13+
### Changes
14+
15+
* [#1388](https://github.com/rubocop/rubocop-rails/pull/1388): Modify `Rails/Pluck` to ignore `map/collect` when used inside blocks to prevent potential N+1 queries. ([@masato-bkn][])
16+
17+
[@koic]: https://github.com/koic
18+
[@masato-bkn]: https://github.com/masato-bkn
19+
[@viralpraxis]: https://github.com/viralpraxis

0 commit comments

Comments
 (0)