1
I have some files that are services, organs, units. The agencies have services and units. I, in the jsons I have, can return to the part where, for example: localhost/api/organs/.json. that it returns the services and units that the organ has. What I wish is that when I reach the point I have set out to be possible, using the id of a service or drive, I can access this service or drive.
json.array!(@organs) do |organ|
json.id @organ.id.to_s
json.unit do
json.id organ.unit.id.to_s
json.name organ.unit.name
json.address organ.organ.unit.address
json.coordinates organ.organ.unit.coordinates
json.schedules organ.unit.schedules
json.phone organ.unit.phone
json.email organ.unit.email
end if organ.unit
json.service @organ.service
Solved your doubt?
– durtto