# Noob question: calling a view in a different folder

**URL:** <https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842>\
**Category:** Rails\
**Created:** [July 19, 2007, 3:35pm UTC](https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842 "2007-07-19T15:35:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [July 19, 2007, 3:35pm UTC](https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842/1 "2007-07-19T15:35:30Z")

</div>

I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i  
want to call an action to send them to the ‘list’ page, which is in  
‘appname’. However i can’t work out how to call an action in a  
different controller/view in a different view folder (incidentally,  
which is called - the controller action or the view page?).

I’ve been trying stuff like

redirect\_to :action =\> “AppnameController.list”  
redirect\_to :action =\> “…/appname/list”

etc…

Can anyone help please? This feels like it’s simple but i just don’t  
know the syntax.

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [July 19, 2007, 3:40pm UTC](https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842/2 "2007-07-19T15:40:10Z")

</div>

Max W. wrote:

> I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i  
> want to call an action to send them to the ‘list’ page, which is in  
> ‘appname’. However i can’t work out how to call an action in a  
> different controller/view in a different view folder (incidentally,  
> which is called - the controller action or the view page?).
> 
> I’ve been trying stuff like
> 
> redirect\_to :action =\> “AppnameController.list”  
> redirect\_to :action =\> “…/appname/list”
> 
> etc…
> 
> Can anyone help please? This feels like it’s simple but i just don’t  
> know the syntax.

you might be looking at

redirect\_to :controller =\> ‘appname’, :action =\> ‘list’  
(if the ‘list’ action is in the appname; redirects there no matter what  
controller you are in)

render :template =\> ‘appname/list’  
(if you want to render the template, you can do this in the controller  
or the view. the path is relative to the app/view directories)

hth

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [July 19, 2007, 3:41pm UTC](https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842/3 "2007-07-19T15:41:36Z")

</div>

Shai R. wrote:

> Max W. wrote:
> 
> > I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i  
> > want to call an action to send them to the ‘list’ page, which is in  
> > ‘appname’. However i can’t work out how to call an action in a  
> > different controller/view in a different view folder (incidentally,  
> > which is called - the controller action or the view page?).
> > 
> > I’ve been trying stuff like
> > 
> > redirect\_to :action =\> “AppnameController.list”  
> > redirect\_to :action =\> “…/appname/list”
> > 
> > etc…
> > 
> > Can anyone help please? This feels like it’s simple but i just don’t  
> > know the syntax.
> 
> you might be looking at
> 
> redirect\_to :controller =\> ‘appname’, :action =\> ‘list’  
> (if the ‘list’ action is in the appname; redirects there no matter what  
> controller you are in)
> 
> render :template =\> ‘appname/list’  
> (if you want to render the template, you can do this in the controller  
> or the view. the path is relative to the app/view directories)
> 
> hth

Never mind, i found the answer! I need to pass the controller as well -

redirect\_to :controller =\> “appname”, :action =\> “list”

Thanks anyway!

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [July 19, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/noob-question-calling-a-view-in-a-different-folder/109842/4 "2007-07-19T15:42:48Z")

</div>

> you might be looking at
> 
> redirect\_to :controller =\> ‘appname’, :action =\> ‘list’  
> (if the ‘list’ action is in the appname; redirects there no matter what  
> controller you are in)
> 
> render :template =\> ‘appname/list’  
> (if you want to render the template, you can do this in the controller  
> or the view. the path is relative to the app/view directories)
> 
> hth

Ah, that second bit’s useful as well. Thanks a lot!
