views:

16

answers:

2

I have my file structure set up appropriately ( I think ! ) , and claims nothing responds to show.

My file structure :

 views/admin/admin_wysi/index.html.haml

My controller ( controllers/admin/admin_wysis_controller.rb )

class Admin::AdminWysisController < Admin::ApplicationController

 def index
 end

end  

My routes.rb

map.namespace :admin do |admin|
  admin.resource :admin_wysi
end

And my error when I try to access www.website.com/admin/admin_wysi/ :

Unknown action

No action responded to show. Actions: index

What am I doing wrong here?

+1  A: 

The error message is stating that it is looking for a 'show' action instead of a 'index' action. One command to try is 'rake routes' (from your terminal). This will print a list of paths supported by your application and which controller / action they map to. In this case, your issue is fixed with:

map.namespace :admin do |admin|
  admin.resources :admin_wysi # added 's'
end

Performing "map.resource" only routes 6 of the 7 restful routes (not index), so you must use "map.resources" (provided you have multiple resources as opposed to a single resource).

Kevin Sylvestre
+2  A: 

Your routes are singular. But you probably want plural. Change your route definition to this:

map.resources :admin_wysi

Or if you really want a singular route, change your controller to this:

class Admin::AdminWysisController < Admin::ApplicationController

 def show
 end

end  

I addition to all this i suggest you read Rails Guides about routing, it should give some more details how and what is actually going on :)

Tanel Suurhans