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

Fixes #34917 - do not load model constants too early #682

Merged
merged 1 commit into from
May 13, 2022

Conversation

ezr-ondrej
Copy link
Member

@ezr-ondrej ezr-ondrej commented May 12, 2022

Rails do not handle well when namespaced models are loaded prior any unnamespaced one.
EDIT: please let me look smart and don't ask why 🙏
Loading models too soon in initialization process will be imposible with Zeitwerk, so it is good practice anyway.

Rails do not handle well when namespaced models are loaded prior any unnamespaced one.
Loading models too soon in initialization process will be imposible with Zeitwerk, so it is good practice anyway.
Copy link

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and confirm that it un-breaks Rails server

Fixes the error PG::UndefinedTable: ERROR: relation "application_records" does not exist when attempting to run migrations or start the rails server.

ACK 👍

@ezr-ondrej
Copy link
Member Author

Thanks @jeremylenz for the debugging session that has lead to this PR, I'm bit worried there will be more instances of this and I still did not figured out why is this happening :(

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of hardcoding class names as strings all over the place, but if that's what's needed then so be it.

@adamruzicka adamruzicka merged commit 99f2cce into theforeman:master May 13, 2022
@adamruzicka
Copy link
Contributor

Thank you @ezr-ondrej & @jeremylenz !

@ezr-ondrej ezr-ondrej deleted the fix_loading_issues branch May 13, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants