-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails/ApplicationModel
should ignore db/migrate/**
#1342
Labels
enhancement
New feature or request
Comments
searls
added a commit
to standardrb/standard-rails
that referenced
this issue
Aug 26, 2024
This makes sense to me. Do you want to open a PR? |
This issue has been resolved in RuboCop Rails 2.26.1. Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's a common practice to define AR models inside of migrations in order to retain forward compatibility of the migration by avoiding loading any code from
app/
(gems like strong_migrations and my own good_migrations are designed to enforce this).Example from the codebase I'm working on:
This results in:
Of course, if we fixed this by extending from
ApplicationRecord
, that'd load the model fromapp/models/application_record.rb
, which could change in a way such that the migration couldn't be safely run again in the future. I think the cop should ignore anything underdb/migrate/**
as a resultThe text was updated successfully, but these errors were encountered: