Skip to content
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

Merged
merged 1 commit into from Jul 25, 2017

Conversation

@lugray
Copy link
Contributor

@lugray lugray commented Jul 24, 2017

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:

NameError: uninitialized constant ApplicationRecord

Other Information

To ease friction in that case, this also adds a generator for ApplicationRecord.

@rails-bot
Copy link

@rails-bot rails-bot commented Jul 24, 2017

r? @eileencodes

(@rails-bot has picked a reviewer for you, use r? to override)

Copy link
Member

@rafaelfranca rafaelfranca left a comment

This change will need a CHANGELOG entry

@@ -0,0 +1,24 @@
require "rails/generators/active_record"

This comment has been minimized.

@rafaelfranca

rafaelfranca Jul 24, 2017
Member

Missing frozen string literal comment

@lugray lugray force-pushed the lugray:stop_generating_application_record branch 2 times, most recently Jul 24, 2017
@lugray
Copy link
Contributor Author

@lugray lugray commented Jul 24, 2017

Updated.

@lugray lugray force-pushed the lugray:stop_generating_application_record branch Jul 25, 2017
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.
@lugray lugray force-pushed the lugray:stop_generating_application_record branch to 75ccdfe Jul 25, 2017
@eileencodes eileencodes merged commit ec21b97 into rails:master Jul 25, 2017
2 checks passed
2 checks passed
codeclimate 2 fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@eileencodes
Copy link
Member

@eileencodes eileencodes commented Jul 25, 2017

Thanks @lugray! And also thank you for writing an excellent commit message 😸

@lugray lugray deleted the lugray:stop_generating_application_record branch Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants