# passing parameters between controllers

**URL:** <https://discuss.rubyonrails.org/t/passing-parameters-between-controllers/19503>\
**Category:** rubyonrails-talk\
**Created:** [October 21, 2007, 7:16am UTC](https://discuss.rubyonrails.org/t/passing-parameters-between-controllers/19503 "2007-10-21T07:16:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shishir\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@Shishir\_Srivastava](https://discuss.rubyonrails.org/u/Shishir_Srivastava)\
**Post date:** [October 21, 2007, 7:16am UTC](https://discuss.rubyonrails.org/t/passing-parameters-between-controllers/19503/1 "2007-10-21T07:16:49Z")

</div>

Hi,

I am trying to pass some parameters from one controller method to a method in a different controller , using the rediret\_to method. My code is something like this

controllerA

def method1 id =(params['user\_name']) redirect\_to({:controller =\> "controllerB", :action =\> "method2"}, :user=\>id) end

controllerB def method2 user @user=user end

However this doesn't seem to be working , because in view when I use \< %= @user%\> to display the user name , I get the error : wrong number of arguments (0 for 1)

Any clue , where am going wrong.

TIA ~shishir

---

<div class="post-metadata">

**Author:** ![Shishir\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@Shishir\_Srivastava](https://discuss.rubyonrails.org/u/Shishir_Srivastava)\
**Post date:** [October 21, 2007, 6:59pm UTC](https://discuss.rubyonrails.org/t/passing-parameters-between-controllers/19503/2 "2007-10-21T18:59:01Z")

</div>

Thanks Shai !! It worked 🙂

~shishir
