I have application with form containing Parents with its Child rendered through Nested Attributes in view for edit.
Take example of Hr trying to edit an employee details along with his skill ratings. The page render employee detail along with his skillsets in paginated form.
Today when HR edit the first page of skillsets and set request for second page of skillset, I save the modified skillset on the first page in DB and render the second page in view for Edit.
But here the requirement is that, I should not save the first page data when moving to next page, but only when user click the save button on the employee.
I know that, I can save the first page data in temporary storage like Redis and when HR click save, I get the updated details of previous pages from it and save all the childs at once along with the save of employee.
What is the cleanest way of achieving this ?
I do not want to write my custom logic for this, like persisting the previous page in Redis, Then tracking if the page user requesting is available in Redis or not, if not fetching from DB otherwise rendering from Redis and finally looping over the updated child and save along with the parent.