I am building a survey-like rails application. The survey has several particular sections (several views) and in each section there are multiple questions. The user will answer those question (free text) and at the bottom of every section view there should be one submit button that saves all entries.
The model for the user answers is:
user_answers(id:integer, user_answer:string, user_project_id:integer, question_id:integer).
The user_answers have a user_project_id to associate it with their created project and a question_id for a an answer. That way the answers later can be directly associated to the right user project and the corresponding question.
What is best practice to save multiple entries/form_for :user_answers with one submit button at the end of the page?
I read about the javascript method Submit two forms with one button, but I fear if the entries are not saved asynchronously it could lead to errors
Sidekiq could be used to do the jobs asynchronously in the background.
Are there maybe other easier ways to do it?
Thank you in advance!