# \[ANN\] ActionSequence 1.0.1 - Multipage Form Routing

**URL:** <https://www.ruby-forum.com/t/ann-actionsequence-1-0-1-multipage-form-routing/142952>\
**Category:** Rails\
**Created:** [July 13, 2008, 10:17pm UTC](https://www.ruby-forum.com/t/ann-actionsequence-1-0-1-multipage-form-routing/142952 "2008-07-13T22:17:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_ASSSSmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/48db29/32.png) [@Florian\_ASSSSmann](https://www.ruby-forum.com/u/Florian_ASSSSmann)\
**Post date:** [July 13, 2008, 10:17pm UTC](https://www.ruby-forum.com/t/ann-actionsequence-1-0-1-multipage-form-routing/142952/1 "2008-07-13T22:17:19Z")

</div>

Hi Ruby on Rails folks,

I wrote ActionSequence  
([GitHub - boof/action\_sequence: Action Sequencer for Ruby on Rails](http://github.com/boof/action_sequence/tree/master)  
)  
for my company to better handle multipage forms. It comes with a DSL for  
creating a sequence.

# Example

class LinksController

```
 before_filter :link_persistence_implementation #...

 sequence :link_wizard do
   # 1. Step
   enter_description { |s| s.next if @link.valid? :description }
   # 2. Step
   enter_path do |s|
     if params[:back] then s.previous
     elsif @link.valid? :shortcut then s.next
     end
   end
   # 3. Step
   select_target do |s|
     if params[:back] then s.previous
     elsif @link.valid? :path and @link.save then s.next
     end
   end
 end

 def new
   walk_link_wizard_sequence :enter_description
 end
 def edit
   walk_link_wizard_sequence :enter_description
 end

 before_filter :walk_link_wizard_sequence, :only =>

```

[:create, :update]

```
 def create
   unless link_wizard_sequence.finished_with? @step
     render :action => :new
   else
     redirect_to link_path(@link)
   end
 end
 def update
   unless link_wizard_sequence.finished_with? @step
     render :action => :edit
   else
     redirect_to link_path(@link)
   end
 end

```

end

I hope this source is more or less self-explanatory.

The step, if not otherwise defined, is placed in @step. It’s  
identified by  
params[:step].

You can select another walker variable by passing a second argument to  
the  
builder, for example `sequence :another, :page`. In this case the step  
is  
stored in @page and identified by params[:page].

By default the first step is choosen.

A step has a name, for example :enter\_description and an index (here: 1)  
which can be used in your view to select a partial.

The plugin should be fairly easy to hack to fit your needs.

Cheers  
Florian

Source on GitHub: [GitHub - boof/action\_sequence: Action Sequencer for Ruby on Rails](http://github.com/boof/action_sequence/tree/master)  
I work @ Fork Unstable Media GmbH - we hire!

# TODO

- Documentation
