Skip to content

Instantly share code, notes, and snippets.

@vfilby
Created July 11, 2012 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfilby/3090336 to your computer and use it in GitHub Desktop.
Save vfilby/3090336 to your computer and use it in GitHub Desktop.
I am looking to have a wizard with three steps. The first to collect information necessary to build the model. It is necessary that I do this in steps because the model form is build dynamically based on the step 1 and step 2.
class NewWidgetController < ApplicationController
include Wicked::Wizard
steps :select_data_set, :select_type, :widget_settings
def show
render_wizard
end
def update
case step
when :select_data_set
# Catch form values and send them to the next step
# How do I render the next wizard step with the additional parameters?
when :select_type
# Catch form values and send them to the next step
when :widget_settings
# Build model and create
end
render_wizard
end
end
- title "Choose your ammunition..."
= form_tag new_widget_path, :url => wizard_path, :method => :put, :class=>'form-horizontal' do
.control-group
= label_tag "Data set", nil, :class=>'control-label'
.controls
- options = DataSet.all.map { |data_set| [data_set.name,data_set.id] }
= select_tag :type, options_for_select(options)
.form-actions
= submit_tag :next, :class=>'btn btn-primary'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment