Fix: use klass.table_name instead of guessing from associated models#847
Merged
ctran merged 1 commit intoctran:developfrom Jan 31, 2022
Merged
Fix: use klass.table_name instead of guessing from associated models#847ctran merged 1 commit intoctran:developfrom
ctran merged 1 commit intoctran:developfrom
Conversation
Owner
|
Could you add a test to show this does fix the problem you mentioned? |
fe3c50a to
1d6943d
Compare
Contributor
Author
|
Hi @ctran, Same test with master version: I just updated the current test for this part, adding a fake folder in the namespace EDIT: It seems the ci has some issues, feel free to ping me :) |
Contributor
Author
|
@ctran when you have time, can you review again this PR :) |
|
➕ this is more stable! Also might unblock shaky module support of |
|
@ctran could you take a look if this PR is ok? this could solve my issue too :) |
Owner
|
Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Hi,
In a middle of a refactoring task, we came across a issue with globalize + annotate. Annotate is adding a none-existant field to the model:
The issue come when you overide
table_name. For exemple, if we have a modelCountrylocated atmodels/country.rband we decide to move the file in a folder without changing the table_name, we will have:models/folder/country.rbWith the orginal code, we have:
Using table_name is a safer way to do it, in my opinion