Add warnings on belongs_to
presence validation field mismatch
#468
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.
Add warning on Rails relationship presence checks
This problem has occurred since Rails added default validation to Rails' belongs_to relationships in version 6.
Usually when creating forms we set relationships using the foreign key column, i.e.
department_id
, not thedepartment
relationshipattribute itself .
This mismatch causes errors on the object to be reported in the error summary but they won't link properly to the input because it's mapped to a different field.
Solving the problem itself is complex so this is a tentative first step and adds warnings to the guide.
It's really hard to concisely say what's going on, any feedback on wording welcome.
Refs #411
Changes
Preview
(possible misuse of notification banner component 🚨)