Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Validate Grouping while validating GroupAssignment #2232

Merged
merged 4 commits into from
Aug 14, 2019

Conversation

EricPickup
Copy link
Contributor

@EricPickup EricPickup commented Aug 12, 2019

Fixes #2230.

Problem

Groupings are persisted when their associating GroupAssignment is saved, however, if the grouping fails its validation the group assignment will still save with a nil grouping_id.

Solution

Use the validates_associated helper on GroupAssignment to validate the grouping as part of the assignment's validation. I've also added a couple methods to fetch the errors straight from the grouping object since validates_associated only adds a generic Your grouping is invalid error message on the group assignment object.

@EricPickup EricPickup requested a review from a team as a code owner August 12, 2019 22:32
@EricPickup EricPickup self-assigned this Aug 12, 2019
@EricPickup EricPickup requested a deployment to production August 14, 2019 17:58 Abandoned
@JessRudder JessRudder requested a review from a team August 14, 2019 18:36
@EricPickup EricPickup merged commit 6177807 into master Aug 14, 2019
@EricPickup EricPickup deleted the validate-grouping branch August 14, 2019 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

500 Internal server error when creating a Grouping with a duplicate name
3 participants