# Controllers!?

**URL:** <https://www.ruby-forum.com/t/controllers/87633>\
**Category:** Rails\
**Created:** [March 4, 2007, 5:53pm UTC](https://www.ruby-forum.com/t/controllers/87633 "2007-03-04T17:53:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![etikette](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/43a26b/32.png) [@etikette](https://www.ruby-forum.com/u/etikette)\
**Post date:** [March 4, 2007, 5:53pm UTC](https://www.ruby-forum.com/t/controllers/87633/1 "2007-03-04T17:53:21Z")

</div>

when i put: render :action=\>“list” in my “index” method of my  
controller it doesn’t use/create the variables created in the list  
method it only gives the “list” view? is that supposed to happen

---

<div class="post-metadata">

**Author:** ![etikette](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/43a26b/32.png) [@etikette](https://www.ruby-forum.com/u/etikette)\
**Post date:** [March 4, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/controllers/87633/2 "2007-03-04T17:59:38Z")

</div>

Marc Rice wrote:

> when i put: render :action=\>“list” in my “index” method of my  
> controller it doesn’t use/create the variables created in the list  
> method it only gives the “list” view? is that supposed to happen

try

redirect\_to :action =\> “list”

instead.

---

<div class="post-metadata">

**Author:** ![etikette](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/43a26b/32.png) [@etikette](https://www.ruby-forum.com/u/etikette)\
**Post date:** [March 4, 2007, 6:12pm UTC](https://www.ruby-forum.com/t/controllers/87633/3 "2007-03-04T18:12:24Z")

</div>

On Mar 4, 4:52 pm, “libsfan01” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> when i put: render :action=\>“list” in my “index” method of my  
> controller it doesn’t use/create the variables created in the list  
> method it only gives the “list” view? is that supposed to happen

Yes. Calling render :action =\> “list” doesn’t actually run the method  
called ‘list’. It just renders the default view template that would  
have been used if you have called the action ‘list’ normally.

Chris

---

<div class="post-metadata">

**Author:** ![etikette](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/43a26b/32.png) [@etikette](https://www.ruby-forum.com/u/etikette)\
**Post date:** [March 4, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/controllers/87633/4 "2007-03-04T18:18:25Z")

</div>

> Yes. Calling render :action =\> “list” doesn’t actually run the method  
> called ‘list’. It just renders the default view template that would  
> have been used if you have called the action ‘list’ normally.
> 
> Chris

So am i right to assume that you can run different actions on the same  
layout and the variables referenced in the ERB will inherit whatever  
values the ‘calling’ action gives them?
