# Change default view path for an ActionController

**URL:** <https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805>\
**Category:** Rails\
**Created:** [July 9, 2009, 2:56pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805 "2009-07-09T14:56:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 2:56pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/1 "2009-07-09T14:56:07Z")

</div>

Hello all,

i would like to change the default view path for one of my controllers.  
Like  
StudentsController should use templates located in views/persons instead  
views/students. Is that possible?

Greetings, Mike

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:03pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/2 "2009-07-09T15:03:48Z")

</div>

I’m pretty sure you can just call render at the end of the action to  
render  
whatever you want.

> **[ActionController::Base](https://api.rubyonrails.org/classes/ActionController/Base.html#M000676)**
>
> Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed on request and then either it renders a template or redirects to another action.

I’m not sure you would want to do this though.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:05pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/3 "2009-07-09T15:05:33Z")

</div>

jap thats right. but is there a way to change the default path without  
actually touching every controller method?

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:10pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/4 "2009-07-09T15:10:39Z")

</div>

mike wrote:

> Hello all,
> 
> i would like to change the default view path for one of my controllers.  
> Like  
> StudentsController should use templates located in views/persons instead  
> views/students. Is that possible?
> 
> Greetings, Mike

Go to your routes file in config and do something similar:

map.persons ‘/persons’, :controller =\> ‘students’, :action =\> ‘index’

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:11pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/5 "2009-07-09T15:11:25Z")

</div>

Would an after\_filter work?

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/6 "2009-07-09T15:45:57Z")

</div>

i would like to change the view path via a param

On Thu, Jul 9, 2009 at 3:10 PM, Ã„lphÃ¤ BlÃ¼Ã«  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 9, 2009, 3:59pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/7 "2009-07-09T15:59:26Z")

</div>

Hi,

I’d say something like that might do :  
(in your student controller, in the action you want)

respond\_to do |format|  
format.html { render :controller =\> “person”, :action =\> your\_action  
}  
end

Cyril

2009/7/9 mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [July 22, 2009, 10:37pm UTC](https://www.ruby-forum.com/t/change-default-view-path-for-an-actioncontroller/171805/8 "2009-07-22T22:37:31Z")

</div>

I just had the same problem and I solved it by creating symlinks  
between the folders. So, for your example, you could try this command  
in your view folder :

link -s persons students

It would be nice to have a more standard way to change the view folder  
path… Hope it helps!
