I want to do something a bit outside of the typical rails conventions and I wanted to hear what you guys think.
I have a Test model, with nested Questions, and Question_responses, and I have a form (using simple_form_for) where a user selects answers for the questions in a test. That is all working fine, but I would like to add a Flag feature if a test taker thinks a question is bad. Right now, I am using a link_to method to take the user to the flag controller actions that allow them to create the flag, and I temporarily hold onto the test id variable to take them back to the test. That's all working.
However, as one might see, I am not saving the progress of the test before the user heads over to create a flag - so if you were halfway through a test and flagged a question, you would lose your progress. I have an idea, but I'm not sure if it can work with simple_form :
I would post the data to some other action within the tests_controller, save it, redirect to the create the flag, and then redirect back to the test (in an edit method or something like it), and allow the user to finish the test. This should work, but how would I get the view with the form to post the test data to some other url besides the one specified by the simple_form_for @test, url: at the top of the form? Is there a way to conditionally post the data to another url depending on where the user clicked, or override the :submit protocol for the simple form button object? I'm really not sure, but I feel like someone has to have done something like this before.