# One controller+5 forms(stages)

**URL:** <https://www.ruby-forum.com/t/one-controller-5-forms-stages/154923>\
**Category:** Rails\
**Created:** [December 5, 2008, 7:15am UTC](https://www.ruby-forum.com/t/one-controller-5-forms-stages/154923 "2008-12-05T07:15:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbalaji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@rbalaji](https://www.ruby-forum.com/u/rbalaji)\
**Post date:** [December 5, 2008, 7:15am UTC](https://www.ruby-forum.com/t/one-controller-5-forms-stages/154923/1 "2008-12-05T07:15:35Z")

</div>

Hi

Im using one controller+ 5 forms(5 stages). and i used the code but ony  
two  
form data stored in databases.give any suggestion

def wizard  
if params[:stage].nil?

…  
elsif params[:stage].to\_i == 1  
…  
elsif params[:stage].to\_i == 2  
…  
elsif params[:stage].to\_i == 3  
…  
elsif params[:stage].to\_i == 4

…  
else  
…  
end

@next\_stage = @stage+1

render :template =\> ‘wizard\stage’+@next\_stage.to\_s  
end

please help me

Thanks  
balaji

---

<div class="post-metadata">

**Author:** ![rbalaji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@rbalaji](https://www.ruby-forum.com/u/rbalaji)\
**Post date:** [December 6, 2008, 2:42am UTC](https://www.ruby-forum.com/t/one-controller-5-forms-stages/154923/2 "2008-12-06T02:42:19Z")

</div>

Hi.

I also worked on a wizard but instead of having ‘meaningless’ name  
like “stage” I gave each form a ‘real’ name, like ‘contact’ for  
contact information, ‘demographics’ for demographic information and so  
on. This allowed me to have clearly defined actions in my controller  
(contact, demographics, and so on) as of what needed to happen when  
and the correct page was always displayed.

I’m not sure if this is the best way of going but it worked best for  
me.

Pepe

On Dec 5, 1:04 am, “balaji rajagopal” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rbalaji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@rbalaji](https://www.ruby-forum.com/u/rbalaji)\
**Post date:** [December 6, 2008, 12:54pm UTC](https://www.ruby-forum.com/t/one-controller-5-forms-stages/154923/3 "2008-12-06T12:54:40Z")

</div>

Hi

i worked the same method and i got the value…

Thanks  
balaji
