Forum: Ruby on Rails Resource-based routing and controller module

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.
Eric L. (Guest)
on 2009-04-23 06:03
(Received via mailing list)
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
This topic is locked and can not be replied to.