# How to add more actions in namespace route

**URL:** <https://discuss.rubyonrails.org/t/how-to-add-more-actions-in-namespace-route/26137>\
**Category:** rubyonrails-talk\
**Created:** [March 11, 2008, 8:39am UTC](https://discuss.rubyonrails.org/t/how-to-add-more-actions-in-namespace-route/26137 "2008-03-11T08:39:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![myst\_tt](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@myst\_tt](https://discuss.rubyonrails.org/u/myst_tt)\
**Post date:** [March 11, 2008, 8:39am UTC](https://discuss.rubyonrails.org/t/how-to-add-more-actions-in-namespace-route/26137/1 "2008-03-11T08:39:47Z")

</div>

Hello, there: &nbsp;&nbsp;My app has already generated default actions, like index, edit, update, create, etc. , on a namespace "admin" URL, the route is as follow. However, I haven't figured out how to add new actions in class Admin::UsersController and matching it to the route.rb? For example I create a new action named "edit\_role", what else I should put on route.rb so that the route will go and pick this action? Thanks!

map.namespace :admin do |admin| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admin.resources :tasks, :has\_many =\> :comments &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admin.resources :users &nbsp;&nbsp;end

Br, MyST

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [March 11, 2008, 8:54am UTC](https://discuss.rubyonrails.org/t/how-to-add-more-actions-in-namespace-route/26137/2 "2008-03-11T08:54:04Z")

</div>

myst\_tt wrote:

> example I create a new action named "edit\_role", what else I should put on route.rb so that the route will go and pick this action?

> map.namespace :admin do |admin| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admin.resources :tasks, :has\_many =\> :comments &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admin.resources :users &nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;admin.resources :users, :member =\> { :edit\_role =\> :get } or &nbsp;&nbsp;&nbsp;&nbsp;admin.resources :users, :collection =\> { :edit\_role =\> :get }

depending on how it is to be called (with an :id or without).

For full details, see:

[http://api.rubyonrails.com/classes/ActionController/Resources.html#M000308](http://api.rubyonrails.com/classes/ActionController/Resources.html#M000308)

---

<div class="post-metadata">

**Author:** ![myst\_tt](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@myst\_tt](https://discuss.rubyonrails.org/u/myst_tt)\
**Post date:** [March 11, 2008, 9:19am UTC](https://discuss.rubyonrails.org/t/how-to-add-more-actions-in-namespace-route/26137/3 "2008-03-11T09:19:55Z")

</div>

Thanks a lot!
