Forum: Ruby Rails view sub directories?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Vrtwo L. (Guest)
on 2006-03-29 12:41
(Received via mailing list)
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
Andy D. (Guest)
on 2006-03-29 12:53
(Received via mailing list)
On 3/29/06, x1 <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:

http://www.rubyonrails.org/community

Also, for your question, you might be able to modify:
http://wiki.rubyonrails.com/rails/pages/HowToProvi...
to suit your needs.
 - Andy D.
This topic is locked and can not be replied to.