# Resource-based routing and controller module

**URL:** <https://www.ruby-forum.com/t/resource-based-routing-and-controller-module/166239>\
**Category:** Rails\
**Created:** [April 23, 2009, 4:03am UTC](https://www.ruby-forum.com/t/resource-based-routing-and-controller-module/166239 "2009-04-23T04:03:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [April 23, 2009, 4:03am UTC](https://www.ruby-forum.com/t/resource-based-routing-and-controller-module/166239/1 "2009-04-23T04:03:35Z")

</div>

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
