In my Rails/React project, I have a parent class called “Projects”. Projects accept nested attributes for Cabinets via an API call. Projects have many Cabinets.
When I create a project via API, I’m also simultaneously creating the first cabinet object in that same API call. After the cabinet is saved, I’d like to run a job, which I inserted into the Cabinets controller’s create action:
ShelfPartsJob.perform_later(@cabinet.id, 'CREATE')
The issue is this job only runs when I create a standalone Cabinet object. If I create a cabinet through the project, it doesn’t run.
Any suggestions on how to run this job when the project is created? It requires the @cabinet.id value in order to run.