Reputation: 945
This is more of a conceptual question, but I've included some code to make it easier to understand. I have a form to create an auction, one of the fields on the form is to select from a collection of documents.
<div class="field">
<%= f.fields_for :document_attributes do |b| %>
<%= b.label "Choose a Document" %><br>
<%= b.collection_select :id, Document.where(user_id: current_user.id), :id, :title, prompt: true %>
<% end %>
</div>
An Auction has_one :document
A user can either select a document from the dropdown, or go to the documents page and create a new document.
<%= link_to "Add New Document", all_documents_path(current_user.id) %>
The problem is, if and when a user navigates to the create document page, they lose all their progress on the auction form page.
How can I save the progress they’ve made on the auction form, and be able to come right back to it after a user has created a new document?
Upvotes: 0
Views: 152
Reputation: 330
You could give them a save and add document button option that would hit your save action on the auction, then forward them to the add document route.
Upvotes: 1