I'm using jbuilder in my rails project.
On a route I can get the index of my devices or show a device with his id.
But a User have many Devices. So on the route users/:id/devices I would like to be able to get the devices. For the moment I have a partial called _device.json.jbuilder with the path app/views/api/v1/devices/_device.json.jbuilder. I would like to call it from app/views/api/v1/users/devices.json.jbuilder
The answer is to give the full path inside app/views. In that case :
/api/v1/users/devices.json.jbuilder look like this
json.partial! '/api/v1/devices/device', devices: @devices
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With