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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
pwesner (Guest)
on 2009-03-30 19:50
(Received via mailing list)

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.

Danimal (Guest)
on 2009-03-31 19:33
(Received via mailing list)

Take a look at path_prefix:

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

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.

This topic is locked and can not be replied to.