# Sumbitting a form to different controller

**URL:** <https://www.ruby-forum.com/t/sumbitting-a-form-to-different-controller/158262>\
**Category:** Rails\
**Created:** [January 21, 2009, 7:38am UTC](https://www.ruby-forum.com/t/sumbitting-a-form-to-different-controller/158262 "2009-01-21T07:38:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [January 21, 2009, 7:38am UTC](https://www.ruby-forum.com/t/sumbitting-a-form-to-different-controller/158262/1 "2009-01-21T07:38:49Z")

</div>

for multi model projects which have their own controllers and views plus  
forms for editing and adding objects, how do you incorporate two  
different models forms in one view

for example on a todo lists main hub (e.g. hub controller) index view  
you could have a form for “Add new project” and another one “Add a task”

When the user clicks the submit button for one form it will go back to  
the hubs index controller with the input.

How would you get that information to say the “Project” controller`s -  
“add” action.

Do you order the post command to go directly to the project controller  
from the view, bypassing the hub index action OR do you go to the hub  
action index and redirect from there?

If so how do i pass the forms params to the project controller as i  
believe the other controller cant see the values stored in params (it  
came up as nil for me when experimenting)

I have googled for this and found things slighly related but which do  
not answer my question. If anyone could help that would be great!

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [January 21, 2009, 8:47am UTC](https://www.ruby-forum.com/t/sumbitting-a-form-to-different-controller/158262/2 "2009-01-21T08:47:09Z")

</div>

solved, just found out about the url parameter for form\_for. I can now  
submit the form to any controller action i like woohoo
