有我的routes.rb
resources :msgs, only: [:create, :destroy, :new]
resources :sessions, only: [:new, :create, :destroy]
resources :posts, only: [:show, :create, :destroy, :new]
并且有rake路线
![routes][1]
msgs_path POST /msgs(.:format) msgs#create
new_msg_path GET /msgs/new(.:format) msgs#new
DELETE /msgs/:id(.:format) msgs#destroy
sessions_path POS /sessions(.:format) sessions#create
new_session_path GET /sessions/new(.:format) sessions#new
session_path DELETE /sessions/:id(.:format) sessions#destroy
posts_path POST /posts(.:format) posts#create
new_post_path GET /posts/new(.:format) posts#new
post_path GET /posts/:id(.:format) posts#show
DELETE /posts/:id(.:format) posts#destroy
每次我试图删除消息,我得到没有路由匹配[删除]“/ msg.5”我不知道为什么,但资源消息有msgs #new和msgs#destroy在一个路径(new_msgs_path),而资源帖子有单独的url for delete和onether for new actions,猜测这个问题,但我不知道如何修复它。