# Rails view sub directories?

**URL:** <https://www.ruby-forum.com/t/rails-view-sub-directories/56222>\
**Category:** Ruby\
**Created:** [March 29, 2006, 10:41am UTC](https://www.ruby-forum.com/t/rails-view-sub-directories/56222 "2006-03-29T10:41:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d0t1q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9e8a1a/32.png) [@d0t1q](https://www.ruby-forum.com/u/d0t1q)\
**Post date:** [March 29, 2006, 10:41am UTC](https://www.ruby-forum.com/t/rails-view-sub-directories/56222/1 "2006-03-29T10:41:54Z")

</div>

Can anyone show me how to go about placing specific views within a  
directory?

ie:

controllers/hello.rb  
views/hello/english/world.rhtml  
views/hello/english/people.rhtml  
views/hello/spanish/mundo.rhtml  
views/hello/spanish/gente.rhtml

instead of the usual:

controllers/hello.rb  
views/hello/world.rhtml  
views/hello/mundo.rhtml

hello.rb currently contains the basic methods:

class ChartsController \< ApplicationController  
def world  
render\_text(“hello world”)  
end  
def mundo  
render\_text(“hola mundo”)  
end  
def people  
render\_text(“hello people”)  
end  
def gente  
render\_text(“hola gente”)  
end  
end

Ideally, It would contain sub methods or something similiar I would  
htink :-  
class ChartsController \< ApplicationController  
def english  
def world  
render\_text(“hello world”)  
end  
def people  
render\_text(“hello people”)  
end  
end  
def spanish  
def mundo  
render\_text(“hola mundo”)  
end  
def gente  
render\_text(“hola gente”)  
end  
end  
end

The whole goal is to logically group the items within a specific view,  
as well as allow them to be access via:  
localhost/hello/spanish/world

Any ideas? TIA

---

<div class="post-metadata">

**Author:** ![d0t1q](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9e8a1a/32.png) [@d0t1q](https://www.ruby-forum.com/u/d0t1q)\
**Post date:** [March 29, 2006, 10:53am UTC](https://www.ruby-forum.com/t/rails-view-sub-directories/56222/2 "2006-03-29T10:53:25Z")

</div>

On 3/29/06, x1 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> instead of the usual:  
> def world  
> end  
> render\_text(“hello people”)  
> end
> 
> The whole goal is to logically group the items within a specific view,  
> as well as allow them to be access via:  
> localhost/hello/spanish/world
> 
> Any ideas? TIA

This is somewhat off-topic for this list. Try the ruby on rails list:

> **[Ruby on Rails](https://rubyonrails.org)**
>
> A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Also, for your question, you might be able to modify:  
[http://wiki.rubyonrails.com/rails/pages/HowToProvideAlternateViewsForMobileDevices](http://wiki.rubyonrails.com/rails/pages/HowToProvideAlternateViewsForMobileDevices)  
to suit your needs.

- Andy D.
