I’ve checked for the usual spelling mistakes or files in the wrong place. Undoubtedly it will be something simple – but I just can’t see it. What am I missing?
controllers/admin/top_10_pages_controller.rb
class Admin::Top10PagesController < Admin::AdminController
end
models/top_10_page.rb
class Top10Page < ActiveRecord::Base
end
routes.rb
namespace :admin do
resources :top_10_pages
end
rake routes
admin_top_10_pages GET /admin/top_10_pages admin/top_10_pages#index
POST /admin/top_10_pages admin/top_10_pages#create
new_admin_top_10_page GET /admin/top_10_pages/new admin/top_10_pages#new
edit_admin_top_10_page GET /admin/top_10_pages/:id/edit admin/top_10_pages#edit
admin_top_10_page GET /admin/top_10_pages/:id admin/top_10_pages#show
PUT /admin/top_10_pages/:id admin/top_10_pages#update
DELETE /admin/top_10_pages/:id admin/top_10_pages#destroy
URL Called
/admin/top_10_pages
ERROR from development log
ActionController::RoutingError (uninitialized constant Admin::Top10PagesController):
Bob – I think this is an issue with the name of the controller file itself.
When I run
"Top10PagesController".underscorein the console I get"top10_pages_controller"rather than"top_10_pages_controller"Looks like rails is looking for the wrong controller file. Try changing the controller name to top10_pages_controller.rb and see if that works?