Forum: Ruby on Rails How can I divide my Page into different Sections?

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.
21c52bdde1c8ab26d6060807d3e39535?d=identicon&s=25 pwesner (Guest)
on 2009-03-30 17:50
(Received via mailing list)
Hello,

I have the following Problem: On my site I'd like to have different
sections like Community, Shop, etc to be accessed via domain.tld/
Community/Controller/... Its all in the same app and I am using
restful Routes and Controllers. Is there a clean way to handle that
with restful routes?

I also want to be able to know in which Section the user is and i'd
like to use some Controllers in different Sections.

Philipp
E00fa5dff361e0bed4b488d874960889?d=identicon&s=25 Danimal (Guest)
on 2009-03-31 17:33
(Received via mailing list)
Philipp,

Take a look at path_prefix:
http://api.rubyonrails.org/classes/ActionControlle...

That should do what you want. You could go about it other ways as
well, but that's probably the best approach.

Remember that "rake routes" is your best friend in this case... it
lets you see all the path mappings based upon your routes.rb
definitions.

The other way you could do this is to use namespaces. People do this
often for admin sections. You could do this for your various sections.
You have to be careful of naming conventions, though. Search here for
"admin" and/or "namespace" as I know it's been well discussed for
quite some time.

-Danimal
This topic is locked and can not be replied to.