I have the below code for creating a product:
def create
@customer = Customer.find(params[:customer_id])
@product = @customer.products.build(params[:product])
respond_to do |format|
if @product.save
format.html { redirect_to customer_products_path(@customer), notice: 'Product was successfully created.' }
else
format.html { render action: "new" }
format.json { render json: customer_products_path.errors, status: :unprocessable_entity }
end
end
end
To generate the form I use:
<%= form_for([@customer, @product]) do |f| %>
Now, I am wondering, how can I transfer the use to a separate confirmation page before saving the data to the DB. Also with an edit link, so if needed the user can make changes and submit the records finally.
I looked at other questions on stackoverflow, but was unable to create what I want. Any guidance is appreciated.