# Trouble with "namespace" in routes.rb file

**URL:** <https://www.ruby-forum.com/t/trouble-with-namespace-in-routes-rb-file/128741>\
**Category:** Rails\
**Created:** [February 11, 2008, 6:28am UTC](https://www.ruby-forum.com/t/trouble-with-namespace-in-routes-rb-file/128741 "2008-02-11T06:28:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2008, 6:28am UTC](https://www.ruby-forum.com/t/trouble-with-namespace-in-routes-rb-file/128741/1 "2008-02-11T06:28:32Z")

</div>

Hi,

Following some of AndyV’s useful advice, I added this

map.namespace :admin do |adm|  
adm.resources :client  
end

to my config/routes.rb file. However, when I visit  
[http://mydomain.com/admin/client/search](http://mydomain.com/admin/client/search) I get the error:

Unknown action  
No action responded to show

I am extremely confused b/c nowhere do I make reference to a “show”  
action. Here is the code of my app/controllers/admin/  
client\_controller.rb file

=============Begin client\_controller.rb file====================  
class Admin::ClientController \< ApplicationController

```
    def search
    end

    def searchresults
            @users = User.search(params)
    end

    def userdetails
    end

```

end  
=============End client\_controller.rb file=====================

I do have a file, app/views/admin/client/search.rhtml, so I’m not sure  
why its not getting called. Thanks, - Dave

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2008, 7:04am UTC](https://www.ruby-forum.com/t/trouble-with-namespace-in-routes-rb-file/128741/2 "2008-02-11T07:04:19Z")

</div>

adm.resources :client

should be  
adm.resources :client, :collection =\> { :search =\> :get }

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2008, 4:47pm UTC](https://www.ruby-forum.com/t/trouble-with-namespace-in-routes-rb-file/128741/3 "2008-02-11T16:47:36Z")

</div>

Thanks, Ryan. That worked.

So just to be clear, every time I want to add a new method to  
Admin::ClientController, I have to also add that to the collection  
listed below?

- Dave

On Feb 11, 12:03 am, “Ryan B. (Radar)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
