Can I fetch a resource with `get :id`?
To fetch a resource by a specific
id
I use this code:
Is there a shorter already build in way of fetching a single resource by it's id
?3 Replies
Yep!
MyApp.Api.get!(MyApp.Post, id)
TIL!
It uses the primary read action, so it is effectively equivalent to the code snipept provided by @Stefan Wintermeyer .