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

Projects
None yet
5 participants
@lugray
Contributor

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

This comment has been minimized.

rails-bot commented Jul 24, 2017

r? @eileencodes

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

@rafaelfranca

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

This comment has been minimized.

Contributor

lugray commented Jul 24, 2017

Updated.

Stop creating ApplicationRecord on model generation
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.

@eileencodes eileencodes merged commit ec21b97 into rails:master Jul 25, 2017

2 checks passed

codeclimate 2 fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@eileencodes

This comment has been minimized.

Member

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