我有一个名为views/admin/slinky_files/new.html.erb
我正在尝试使用以下链接打开的视图:
<%= link_to 'Add New Slinky', new_slinky_file_path %>
当我单击链接时,这给了我一个错误:
Routing Error
uninitialized constant SlinkyFilesController
当然,这是因为它应该是Admin::SlinkyFilesController
我该如何解决?我不知何故需要路由new_slinky_file_path
到而不是像admin_new_slinky_file_path
我想的那样?
rake routes | grep slinky
输出:
slinkys GET /slinkys(.:format) slinkys#index
POST /slinkys(.:format) slinkys#create
new_slinky GET /slinkys/new(.:format) slinkys#new
edit_slinky GET /slinkys/:id/edit(.:format) slinkys#edit
slinky GET /slinkys/:id(.:format) slinkys#show
PUT /slinkys/:id(.:format) slinkys#update
DELETE /slinkys/:id(.:format) slinkys#destroy
slinky_files GET /slinky_files(.:format) slinky_files#index
POST /slinky_files(.:format) slinky_files#create
new_slinky_file GET /slinky_files/new(.:format) slinky_files#new
edit_slinky_file GET /slinky_files/:id/edit(.:format) slinky_files#edit
slinky_file GET /slinky_files/:id(.:format) slinky_files#show
PUT /slinky_files/:id(.:format) slinky_files#update
DELETE /slinky_files/:id(.:format) slinky_files#destroy
admin_slinkys GET /admin/slinkys(.:format) admin/slinkys#index
POST /admin/slinkys(.:format) admin/slinkys#create
new_admin_slinky GET /admin/slinkys/new(.:format) admin/slinkys#new
edit_admin_slinky GET /admin/slinkys/:id/edit(.:format) admin/slinkys#edit
admin_slinky GET /admin/slinkys/:id(.:format) admin/slinkys#show
PUT /admin/slinkys/:id(.:format) admin/slinkys#update
DELETE /admin/slinkys/:id(.:format) admin/slinkys#destroy