Hey I have this in my router resources("/recordings", RecordingController)
and i have some auto generated code and the index and show is working nicely but the put and delete request are saying that they cannot find route, but if i put it explicitly like put("/recordings", RecordingController, :update)
then it is workings nicely.
Why is that? isn’t that the point of resources do it all in one?
I’ve not used postman before, but where-ever it got that URL of PUT in /api/recordings from is definitely wrong, you have no route for that. You either ‘PUT’ or PATCH into an ID of the form /api/recordings/:id or you POST a new entry into /api/recordings, what it is trying to do of PUT into /api/records is not a valid route that Phoenix’s route helpers should have given it (it wouldn’t even have compiled…), so I’m thinking that’s either a manual mis-type or something is horribly broken in Postman? o.O?
Yes, changing the put like that removes the required :id from the URL, but the error from postman was showing the case when the :id was very much required in the URL instead of the body. That’s the way the REST standards work if that is what you are trying to follow. If you are not following REST then probably shouldn’t be using resource.