Rails view sub directories?

X

x1

Can anyone show me how to go about placing specific views within a director=
y?

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
 
A

Andy Delcambre

Can anyone show me how to go about placing specific views within a direct= ory?

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


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/HowToProvideAlternateViewsForMobile=
Devices
to suit your needs.
- Andy Delcambre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,062
Members
47,669
Latest member
johnmaxwell

Latest Threads

Top