This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Jul 13 04:41:10 -0700 2008 | |
| |
MIT-LICENSE | Sun Jul 13 04:06:53 -0700 2008 | |
| |
README.rdoc | Mon Jul 14 00:45:57 -0700 2008 | |
| |
Rakefile | ||
| |
init.rb | Sun Jul 13 04:06:53 -0700 2008 | |
| |
lib/ | Mon Jul 14 00:45:57 -0700 2008 | |
| |
tasks/ | Sun Jul 13 04:06:53 -0700 2008 | |
| |
test/ |
ActionSequence
Multipage form routing for controller actions.
This plugin adds simple sequencing functionality to controller actions. ActionSequence does so by tracking a so called walker parameter.
Features
- seperates form routing from controller actions
- easy DSL (ActionSequence::Initializer)
- easy to customize because of it’s simple layout (ActionSequence / ActionSequence::Walker / ActionSequence::Step)
- tested (with test/spec)
Example
class ItemController < ApplicationController
# Initialize item sequence to fetch current index from params[:steps_name]
sequence :item, :steps_name do
enter_stuff do |s|
if params[:back] then s.previous
elsif @item.valid_stuff? then s.next
end
end
select_other_stuff(:meth1, :meth2) do |s|
if params[:back] then s.previous
elsif @item.save then s[:finished]
end
end
end
before_filter :load_item
before_filter :walk_item_sequence, :only => [:create, :update]
# Executed when :select_other_stuff is walked.
def meth1
# does something
end
def meth2
# does something
end
# Walks a specific step, means:
#
# Assigns step to @steps_name and runs required methods,
# but doesn't execute steps decision block!
def new
walk_item_sequence :enter_stuff
end
def edit
walk_item_sequence :enter_stuff
end
# Walk to params[:steps_name]
def create
unless item_sequence.finished_with? @steps_name
render :action => :new
else
redirect_to :action => :list
end
end
def update
unless item_sequence.finished_with? @steps_name
render :action => :edit
else
redirect_to :action => :list
end
end
end
Copyright © 2008 Florian Aßmann, released under the MIT license












