Skip to content

Commit

Permalink
Change Rails/ApplicationRecord to ignore migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Sep 3, 2024
1 parent b59cecf commit ff07593
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#1342](https://github.com/rubocop/rubocop-rails/issues/1342): Change `Rails/ApplicationRecord` to ignore migrations. ([@fatkodima][])
4 changes: 3 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ Rails/ApplicationRecord:
Enabled: true
SafeAutoCorrect: false
VersionAdded: '0.49'
VersionChanged: '2.5'
VersionChanged: '<<next>>'
Exclude:
- db/**/*.rb

Rails/ArelStar:
Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
Expand Down
4 changes: 4 additions & 0 deletions lib/rubocop/cop/rails/application_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ module Cop
module Rails
# Checks that models subclass `ApplicationRecord` with Rails 5.0.
#
# It is a common practice to define models inside migrations in order to retain forward
# compatibility by avoiding loading any application code. And so migration files are excluded
# by default for this cop.
#
# @safety
# This cop's autocorrection is unsafe because it may let the logic from `ApplicationRecord`
# sneak into an Active Record model that is not purposed to inherit logic common among other
Expand Down

0 comments on commit ff07593

Please sign in to comment.