# Extending a wizard

**URL:** <https://www.ruby-forum.com/t/extending-a-wizard/157456>\
**Category:** Rails\
**Created:** [January 11, 2009, 3:04pm UTC](https://www.ruby-forum.com/t/extending-a-wizard/157456 "2009-01-11T15:04:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Commander\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Commander\_J](https://www.ruby-forum.com/u/Commander_J)\
**Post date:** [January 11, 2009, 3:04pm UTC](https://www.ruby-forum.com/t/extending-a-wizard/157456/1 "2009-01-11T15:04:53Z")

</div>

Hi,  
I’ve created a simple wizard that collects data in 3 steps and then  
posts it  
to a Create action.

Validation is only performed when the data is posted. However, I would  
like  
the individual steps to be validated as well. Any ideas on this one?

Example:  
Step 1  
Name  
Email  
Email (confirm)

Is there a generic way to let ActiveRecord validate the individual  
fields of  
a Model Object instead of the entire thing?

CmdJohnson

---

<div class="post-metadata">

**Author:** ![Commander\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Commander\_J](https://www.ruby-forum.com/u/Commander_J)\
**Post date:** [January 11, 2009, 3:20pm UTC](https://www.ruby-forum.com/t/extending-a-wizard/157456/2 "2009-01-11T15:20:43Z")

</div>

On 11 Jan 2009, at 14:04, Commander J. wrote:

> Step 1  
> Name  
> Email  
> Email (confirm)
> 
> Is there a generic way to let ActiveRecord validate the individual  
> fields of a Model Object instead of the entire thing?

The if/unless options on validates\_\* may be of interest.

Fred

---

<div class="post-metadata">

**Author:** ![Commander\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Commander\_J](https://www.ruby-forum.com/u/Commander_J)\
**Post date:** [January 16, 2009, 10:28pm UTC](https://www.ruby-forum.com/t/extending-a-wizard/157456/3 "2009-01-16T22:28:23Z")

</div>

Could you please post some code to explainify?

On Sun, Jan 11, 2009 at 3:20 PM, Frederick C. \<

---

<div class="post-metadata">

**Author:** ![Commander\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Commander\_J](https://www.ruby-forum.com/u/Commander_J)\
**Post date:** [January 16, 2009, 11:58pm UTC](https://www.ruby-forum.com/t/extending-a-wizard/157456/4 "2009-01-16T23:58:11Z")

</div>

On 16 Jan 2009, at 21:27, Commander J. wrote:

> Could you please post some code to explainify?

validates\_foo :if =\> :bar

will run that validation only if the bar method returns true. so you  
can conditionalize your validations on anything you want.

Fred
