我遇到了奇怪的错误。我不确定这是错误。但是我以前从未遇到过这种奇怪的行为。
resource :watches
制作了这样奇怪的路由表:
watches POST /watches(.:format) watches#create
new_watches GET /watches/new(.:format) watches#new
edit_watches GET /watches/edit(.:format) watches#edit
GET /watches(.:format) watches#show
PUT /watches(.:format) watches#update
DELETE /watches(.:format) watches#destroy
如您所见,没有 ID 参数和混乱的操作
同时:
resources :mibs
制定正确的路线
mibs GET /mibs(.:format) mibs#index
POST /mibs(.:format) mibs#create
new_mib GET /mibs/new(.:format) mibs#new
edit_mib GET /mibs/:id/edit(.:format) mibs#edit
mib GET /mibs/:id(.:format) mibs#show
PUT /mibs/:id(.:format) mibs#update
DELETE /mibs/:id(.:format) mibs#destroy
我认为这可能是某种变形器问题,但尝试使用“火箭”而不是“手表”会得到相同的结果:
rockets POST /rockets(.:format) rockets#create
new_rockets GET /rockets/new(.:format) rockets#new
edit_rockets GET /rockets/edit(.:format) rockets#edit
GET /rockets(.:format) rockets#show
PUT /rockets(.:format) rockets#update
DELETE /rockets(.:format) rockets#destroy
除了我的前两个资源(服务器和 mibs)之外的任何东西都会产生这样的结果。
可能在某处损坏了路由缓存?