I don't have huge experience with this, but you may be able to benefit from: Wizard Forms Railscast
I'd imagine this type of setup will save the step 1
, step 2
, etc params as session variables:
class ExperimentsController < ApplicationController
def wizard_step_1
render template: "experiments/wizards/step1"
end
def wizard_step_2
render template: "experiments/wizards/step2"
#Create session vars from step1
session[:user][:name] = params[:user_name]
end
def wizard_step_3
binding.pry
#Step2 is already passed as params ;)
params[:user_name] = session[:user][:name]
end
end
View step1 below:
<%= form_tag(action: 'wizard_step_2') do %>
<%= text_field_tag("user_name") %>
<%= submit_tag("Next >>") %>
<% end %>
View step2 below:
<%= form_tag(action: 'wizard_step_3') do %>
<%= text_field_tag("user_email") %>
<%= submit_tag("Next >>") %>
<% end %>
I know this example is not very DRY, but it's the basis of what I'd start to look at. Essentially, you need to be able to persist data between instances of objects, which lends itself entirely to sessions