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 in user
PublicBooks, PublicPages #=> The users books will be whatever user is specified.
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
thier own book through a public interface and wants to say edit
it. In this case I’m thinking of just re-directing to the edit
action of the MyBooksController
I really don’t have a clue how to proceed here. Here’s what I’m thinking but I don’t believe this works.
map.resources :books :path_prefix => ‘my’, :controller => ‘my_books_controller’ do
books.resources :pages, :controller => ‘my_pages_controller’ do
map.resources :books :path_prefix => ‘/:username’, :controller => ‘public_books_controller’ do
books.resources :pages, :controller => ‘public_pages_controller’ do
Can anyone give a little advice please? Is this even a good way to go, or should I be looking elsewhere for a solution?