gpt4 book ai didi

ruby-on-rails - Rails 路由的未初始化常量问题

转载 作者:行者123 更新时间:2023-12-04 19:24:00 26 4
gpt4 key购买 nike

这是我的路由配置:

map.resources :services do |services|
services.resources :capabilities do |capabilities|
能力.资源:http_headers
结尾
结尾

这是我的“rake 路线”输出:

laran:trunk laran$ rake 路线
(在/Users/laran/workspace/kibo/mega/server/trunk 中)
帐户 GET/accounts(.:format) {:action=>"index", :controller=>"accounts"}
POST/accounts(.:format) {:action=>"create", :controller=>"accounts"}
new_account GET/accounts/new(.:format) {:action=>"new", :controller=>"accounts"}
edit_account GET/accounts/:id/edit(.:format) {:action=>"edit", :controller=>"accounts"}
account GET/accounts/:id(.:format) {:action=>"show", :controller=>"accounts"}
PUT/accounts/:id(.:format) {:action=>"update", :controller=>"accounts"}
删除/accounts/:id(.:format) {:action=>"destroy", :controller=>"accounts"}
services GET/services(.:format) {:action=>"index", :controller=>"services"}
POST/services(.:format) {:action=>"create", :controller=>"services"}
new_service GET/services/new(.:format) {:action=>"new", :controller=>"services"}
edit_service GET/services/:id/edit(.:format) {:action=>"edit", :controller=>"services"}
service GET/services/:id(.:format) {:action=>"show", :controller=>"services"}
PUT/services/:id(.:format) {:action=>"update", :controller=>"services"}
删除/services/:id(.:format) {:action=>"destroy", :controller=>"services"}
service_capabilities GET/services/:service_id/capabilities(.:format) {:action=>"index", :controller=>"capabilities"}
POST/services/:service_id/capabilities(.:format) {:action=>"create", :controller=>"capabilities"}
new_service_capability GET/services/:service_id/capabilities/new(.:format) {:action=>"new", :controller=>"capabilities"}
edit_service_capability GET/services/:service_id/capabilities/:id/edit(.:format) {:action=>"edit", :controller=>"capabilities"}
service_capability GET/services/:service_id/capabilities/:id(.:format) {:action=>"show", :controller=>"capabilities"}
PUT/services/:service_id/capabilities/:id(.:format) {:action=>"update", :controller=>"capabilities"}
删除/services/:service_id/capabilities/:id(.:format) {:action=>"destroy", :controller=>"capabilities"}
service_capability_http_headers GET/services/:service_id/capabilities/:capability_id/http_headers(.:format) {:action=>"index", :controller=>"http_headers"}
POST/services/:service_id/capabilities/:capability_id/http_headers(.:format) {:action=>"create", :controller=>"http_headers"}
new_service_capability_http_header GET/services/:service_id/capabilities/:capability_id/http_headers/new(.:format) {:action=>"new", :controller=>"http_headers"}
edit_service_capability_http_header GET/services/:service_id/capabilities/:capability_id/http_headers/:id/edit(.:format) {:action=>"edit", :controller=>"http_headers"}
service_capability_http_header GET/services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"show", :controller=>"http_headers"}
PUT/services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"update", :controller=>"http_headers"}
删除/services/:service_id/capabilities/:capability_id/http_headers/:id(.:format) {:action=>"destroy", :controller=>"http_headers"}
/login {:action=>"login", :controller=>"accounts"}
/logout {:action=>"logout", :controller=>"accounts"}
root/{:action=>"index", :controller=>"default"}
拉兰:树干拉兰$

但是,当我转到/services/new 时,出现此错误:

服务 Controller 中的名称错误#new

未初始化的常量 ServicesController::Services

是什么赋予了?我怎样才能让事情正常工作并正确路由?谢谢。

最佳答案

ServicesController 是否由模型服务支持?您是否不小心在 Controller 中将其引用为服务?

关于ruby-on-rails - Rails 路由的未初始化常量问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1126587/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com