laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org
2008-Feb-09 23:20 UTC
Weird "Unknown action" error
Hi, When I visit this URL in my app, 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============================ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 AndyV On Feb 9, 6:20 pm, "laredotorn...-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org" <laredotorn...-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org> wrote:> Hi, > > When I visit this URL in my app,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============================--~--~---------~--~----~------------~-------~--~----~You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---