Resource-based routing and controller module


#1

I have a Request resource in my application. A “Request” is created
by users of the system, but managed by administrators. For example,
user creates a request to fix a chair, and administrator views and
edits the request. As a result, I want to create two Request
controllers: Admin::RequestsController and RequestsController. The
latter is for users of the system to create requests, and lack the
view, update, and delete actions, which are in
Admin::RequestsController only.

My problem is regarding routing. The simple “map.resources :requests”
declaration in routes.rb only generates routes for the user
RequestsController. Is there a way to have it route POST requests to
the user RequestsController (with URL /requests), and route all other
requests (PUT, GET, etc.) to Admin::RequestsController (with URL /
admin/requests)?

Thanks,
Eric