2

I am using GraphQL Ruby and making it compatible with Relay. I am trying to find the correct way of creating records in a join table using Relays node IDs. I know I can take an array of node IDs and get look up each object using Schema.object_from_id, but that would cause an N+1 query and I am trying to avoid that.

Is that the only way to do it if I use Relay node IDs? What is the best practice for this situation?

Data model for reference:

We have Photos, Gallerys, and the join model is GalleryPhoto. I have the ids for the photos and want to create a new gallery.

CWitty
  • 4,488
  • 3
  • 23
  • 40

0 Answers0