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
Stop creating ApplicationRecord on model generation #29916
Stop creating ApplicationRecord on model generation #29916
Conversation
r? @eileencodes (@rails-bot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will need a CHANGELOG entry
@@ -0,0 +1,24 @@ | |||
require "rails/generators/active_record" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing frozen string literal comment
8895f23
to
45ab73f
Compare
Updated. |
45ab73f
to
bdbd5fd
Compare
When generating models, we created ApplicationRecord in the default location if no file existed there. That was annoying for people who moved it to somewhere else in the autoload path. At this point, the vast majority of apps should have either run the upgrade script or generated a model since upgrading. For those that haven't the error message after generating a new model should be helpful: NameError: uninitialized constant ApplicationRecord To ease friction in that case, this also adds a generator for ApplicationRecord.
bdbd5fd
to
75ccdfe
Compare
Thanks @lugray! And also thank you for writing an excellent commit message |
Fixes #29407.
Summary
When generating models, we created ApplicationRecord in the default location if no file existed there. That was annoying for people who moved it to somewhere else in the autoload path. At this point, the vast majority of apps should have either run the upgrade script or generated a model since upgrading. For those that haven't the error message after generating a new model should be helpful:
Other Information
To ease friction in that case, this also adds a generator for ApplicationRecord.