# Weird "Unknown action" error

**URL:** <https://www.ruby-forum.com/t/weird-unknown-action-error/128662>\
**Category:** Rails\
**Created:** [February 10, 2008, 12:21am UTC](https://www.ruby-forum.com/t/weird-unknown-action-error/128662 "2008-02-10T00:21:07Z")\
**Posts on this page:** 2\
**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 10, 2008, 12:21am UTC](https://www.ruby-forum.com/t/weird-unknown-action-error/128662/1 "2008-02-10T00:21:07Z")

</div>

Hi,

When I visit this URL in my app, [http://mydomain.com/admin/user/search](http://mydomain.com/admin/user/search),  
I get

Unknown action  
No action responded to user

I am confused by this because I have these files

app/controllers/admin\_controller.rb  
app/controllers/admin/user\_controller.rb  
app/views/admin/user/search.rhtml

Here is the code for the controllers

=====================Begin admin\_controller.rb===================  
class AdminController \< ApplicationController  
before\_filter :subscriber\_login\_required # defined in  
application.rb  
end  
=====================End admin\_controller.rb ====================

=====================Begin user\_controller.rb====================  
class Admin::UserController \< ApplicationController

```
    def search
    end

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

    def userdetails
    end

```

end  
=====================End user\_controller.rb=====================

Your help is always appreciated, - Dave

If it helps, here’s my config/routes.rb file:  
====================Begin routes.rb file=========================  
ActionController::Routing::Routes.draw do |map|

map.connect ‘’, :controller =\> “register”, :action =\> “start”

map.resources :users  
map.resources :sessions  
map.signup ‘/signup’, :controller =\> ‘users’, :action =\> ‘new’  
map.login ‘/login’, :controller =\> ‘sessions’, :action =\> ‘new’  
map.logout ‘/logout’, :controller =\> ‘sessions’, :action =\>  
‘destroy’

# The priority is based upon order of creation: first created →

highest priority.

# Sample of regular route:

# map.connect ‘products/:id’, :controller =\> ‘catalog’, :action =\>

‘view’

# Keep in mind you can assign values other than :controller

and :action

# Sample of named route:

# map.purchase ‘products/:id/purchase’, :controller =\>

‘catalog’, :action =\> ‘purchase’

# This route can be invoked with purchase\_url(:id =\> product.id)

# You can have the root of your site routed by hooking up ‘’

# – just remember to delete public/index.html.

# map.connect ‘’, :controller =\> “welcome”

# Allow downloading Web Service WSDL as a file with an extension

# instead of a file named ‘wsdl’

map.connect ‘:controller/service.wsdl’, :action =\> ‘wsdl’

# Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id.:format’  
map.connect ‘:controller/:action/:id’  
end  
=====================End routes.rb file=============================

---

<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 10, 2008, 10:24pm UTC](https://www.ruby-forum.com/t/weird-unknown-action-error/128662/2 "2008-02-10T22:24:57Z")

</div>

Dave,

For the structure you’re showing I believe that you want to use the  
new ‘namespace’ option for route mapping:

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

Here’s the online API for ref:  
[http://api.rubyonrails.org/classes/ActionController/Routing/RouteSet/Mapper.html#M000351](http://api.rubyonrails.org/classes/ActionController/Routing/RouteSet/Mapper.html#M000351)

AndyV

On Feb 9, 6:20 pm, “removed\_email\_address@domain.invalid”
