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
Better handling of negative words in enum #39065
Comments
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
Thanks @ghiculescu. |
Yeah that’s correct. I’m happy to do both; for our app I just wanted the warning gone. |
Fixes rails#39065. Adds a more descriptive warning, and logs it less often.
Actual behavior
Given the models:
They will generates the following warnings:
It will also generate the two scopes:
Expected behavior
The warning added by #36380 can be quite enigmatic, if not useless, when there are no conflicts in the enumeration.
Does it mean we should ban
not_
words from enum ?I don't think so.
The method
detect_negative_condition
used in active_record/enum.rb#L203 should check the whole enum collection to detect potential conflicts.Could we generate an
implemented
scope instead of anot_not_implemented
?I will be happy to propose a pull request (or two) after receiving some opinions.
System configuration
Rails version: 6.0.2.2
Ruby version: 2.6.3
The text was updated successfully, but these errors were encountered: