Partial validations in Wizards

Anatol Pomozov
2005-10-19T18:16:18Z

Hi, all.

I need to implement registration wizard for ror app. Nothing special just
several sequent screens
1. Please enter your name, login password, email
2. enter date of birth, location
3. Something else
It is rather usual situation.

User comes to first screen and fills field press submit. Method
''step1'' of
register controller invoked.
The problem there with validation: I need only validate specific fields, not
all.
I am using now following code
@user = Character.new(params[:character])
@user.errors.add(''plan'') unless 1..4 === @character.plan
@user.errors.add_on_blank(%w(firstname lastname country))
But I fell like it is violation of DRY principle because I already have
validate rules in model.

What is the best pattern in this situation??

And one more question: where better to save data between wizard steps?? In
session or save to hidden fields? What do you advise me??
--
anatol


_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org