rockandrollwithemberjs/rarwe-issues

New songs are not saved on the back-end

Closed this issue · 5 comments

As reported by @cg-fnba:

"At the end of chapter 9, should new songs be persisting on the back end? New bands are, but songs are not, for me. I have compared my catalog service and my songs controller with the one in the appropriate tag in your repository and they are identical.

After saving, status says 201 Created.

This is my payload:

{data: {type: "songs", attributes: {title: "Another Song"},…}}
data: {type: "songs", attributes: {title: "Another Song"},…}
attributes: {title: "Another Song"}
title: "Another Song"
relationships: {band: {data: {id: "another-band", type: "bands"}}}
band: {data: {id: "another-band", type: "bands"}}
data: {id: "another-band", type: "bands"}
type: "songs"

"

@cg-fnba Indeed when I checked out the repo at that commit, the songs failed to be saved on the back-end:

https://capture.dropbox.com/jSpb9VfKvcn34JN0

@cg-fnba This is fixed now - it was a back-end error. I recently upgraded the back-end and lost a piece of code in the process which made this work 😅

Thank you! What are you using for the back-end?

It's a simple Rails app with jsonapi-resources as the library (gem) to provide JSON::API support.

I have fixed this and even blogged about it :D
https://devjournal.balinterdi.com/dont-fix-the-same-problem-twice/