I am attempting to fetch a backend model (person) from an Ember application. I would like to access a nested model (location) directly in the response from my person model. Therefore, the response needs to include a nested model (location), which has a belongs to relationship on the person model. I have added an allowable_includes method in the person controller, see below. Although my rails query parameters show the location model is included, the location value is null when I attempt to access a value (city) on the location model (location.city) in the frontend. My network response shows included failed for the location model. I know location is not null, because I can view it in my rails console. Is there something I am missing here?
Query Params:
http://localhost:3000/person?include=location
Network Response:
location: {meta: {included: false}}
person_controller.rb:
def allowable_includes
{
'location' => {}
}
Aucun commentaire:
Enregistrer un commentaire