-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #468 from x-govuk/add-warnings-on-belongs-to-prese…
…nce-field-mismatch Add warnings on `belongs_to` presence validation field mismatch
- Loading branch information
Showing
5 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.govuk-notification-banner[ | ||
role="region" | ||
aria-labelledby="govuk-notification-banner-title" | ||
data-module="govuk-notification-banner" | ||
] | ||
.govuk-notification-banner__header | ||
.govuk-notification-banner__title | ||
| Important | ||
.govuk-notification-banner__content | ||
markdown: | ||
Note that Rails now adds presence validation to associations | ||
automatically but usually we set relationships by assigning values to the | ||
foreign key column. | ||
|
||
This results in errors being added to the object on attributes that don't | ||
appear in the form, for example on `department` instead of | ||
`department_id`. | ||
|
||
You can suppress this behaviour by adding `optional: true` to the relationship | ||
and manually adding the presence validation to the foreign key field yourself. |