alex_hill's avatar

Adding attachments to an item that does not yet exist

I am looking to build some functionality where users enter info about a Job (model) and can add attachments to that Job before pressing the submit button.

In terms of relationships, the Job and Attachment are always one-to-many.

The issue is when I upload a file I want to be able to attach it using job_id, but that job doesnt exist until the submit process is complete (after uploading the docs).

My current thought is to create the relationship as a many-to-many with an intermediate mapping table. That way I can load Attachments and then link them to the newly created Job on the submit process.

Is there a better way to handle this?

0 likes
2 replies
gustav1105's avatar

Maybe it is possible to create the job and enter it into the database and on return call the method that will upload the relevant material to that job

Please or to participate in this conversation.