[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rails view sub directories?

x1

3/29/2006 8:42:00 AM

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


1 Answer

Andy Delcambre

3/29/2006 8:53:00 AM

0

On 3/29/06, x1 <caldridge@gmail.com> wrote:
> 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
>
>


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

http://www.rubyonrails.org...

Also, for your question, you might be able to modify:
http://wiki.rubyonrails.com/rails/pages/HowToProvideAlternateViewsForMob...
to suit your needs.
- Andy Delcambre