Skip to content

Render useful errors when album artists are invalid - #999

Draft
robbevp wants to merge 2 commits into
mainfrom
enhc/album-artists-errors-response
Draft

Render useful errors when album artists are invalid#999
robbevp wants to merge 2 commits into
mainfrom
enhc/album-artists-errors-response

Conversation

@robbevp

@robbevp robbevp commented Aug 29, 2026

Copy link
Copy Markdown
Member

Fixes #1000

Draft PR with a failing test - I'll pick this up later again

  • I've added tests relevant to my changes.

@robbevp robbevp self-assigned this Aug 29, 2026
@robbevp robbevp added the bug Something isn't working label Aug 29, 2026
@robbevp
robbevp force-pushed the fix/separator-validations branch from ac58e48 to adfc3ec Compare August 29, 2026 15:05
Base automatically changed from fix/separator-validations to main August 29, 2026 20:41
@robbevp
robbevp force-pushed the enhc/album-artists-errors-response branch from fca2bd5 to 61d1ddf Compare August 30, 2026 08:28
@robbevp

robbevp commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

@chvp I added a POC for how we could fix this situation: if we use accepts_nested_attributes_for, we (1) don't have update raise when assigning an invalid association and (2) get errors that are more specific about the association (though you still don't know which of the album artists is invalid).

Two other options I see:

  • We recreate this behaviour ourselves in the controller
  • We allow album_artists_attributes rather than album_artists and require the client to send the data in the expected format (note that this would need to include {id: 1, _destroy: true } for records that should be removed

I think I have a preference for the last option, our web client already handles a bunch of logic when editing data so it feels more at home there than in the controllers. This also means that requests could be more granular and actually update one album_artist at a time, without needing to resend all the other data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating an record with invalid associations results in empty body

1 participant