I have a url scheme where I would like to include a public and private
interface, and I have a nested resource for it.
The two schemes are
I would like to sperate the books and pages controllers into
MyBooks, MyPages #=> the user here will always be the currently logged
PublicBooks, PublicPages #=> The users books will be whatever user is
All public stuff is read only, although there will be a further nested
resource on both (comments) that should be mapped to one controller to
controll all comments, read and write.
I’m thinking at the moment that this will eliminate a lot of messy
controller logic that tries to decide if I can access things or not, and
tries to decide what user the context of the request is in etc.
The messiest that I can see this getting is if the user is accessing
own book through a public interface and wants to say edit it. In this
I’m thinking of just re-directing to the edit action of the
I really don’t have a clue how to proceed here. Here’s what I’m
but I don’t believe this works.
map.resources :books :path_prefix => ‘my’, :controller =>
books.resources :pages, :controller => ‘my_pages_controller’ do
map.resources :books :path_prefix => ‘/:username’, :controller =>
books.resources :pages, :controller => ‘public_pages_controller’ do
Can anyone give a little advice please? Is this even a good way to go,
should I be looking elsewhere for a solution?