Trouble with "namespace" in routes.rb file

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 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

adm.resources :client

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

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)” [email protected]