Project

gendalf

0.0
No commit activity in last 3 years
No release in over 3 years
Trivial gem to support wizard application style creation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 3.0.4
>= 3.0.4
 Project Readme

Gendalf wizard helper gem

Makes it easier to add wizard-like behaviour to your application.

[Make yourself] an example

  1. Connect Gendalf wizardry gem to your application:

    gem 'gendalf'

  2. Create the source files in your project:

custom_wizard_controller.rb

class CustomWizardController < Gendalf::WizardController
  layout "application"
  set_model_name :user_info

  def step0
  end

  def step1
  end

  def step2
    @user_info = session[:user_info]
  end

protected
  def wizard_model
    session[:user_info] ||= UserInfo.new
  end  

  def current_step
    session[:current_step] ||= 0
  end

  def current_step=(step)
    session[:current_step] = step
  end
end

user_info.rb

class UserInfo < Gendalf::WizardModel
  define_step 0, :name do
    validates_presence_of :name
  end

  define_step 1, :surname do
    validates_presence_of :surname
  end

  define_final_step 2
end
  1. Add the route:

    wizard 'wizard', :custom_wizard, 3

  2. Launch the application and navigate to http://localhost:3000/wizard/ .

Get a working example

  1. Clone the repository: git://github.com/SkyWriter/Gendalf-Demo.git .

  2. Run bundler.

  3. Launch the application and navigate to http://localhost:3000/wizard/ .