Ruby on rails 没有与[删除]匹配的路由”/味精5“;
这是我的路线Ruby on rails 没有与[删除]匹配的路由”/味精5“;,ruby-on-rails,Ruby On Rails,这是我的路线 resources :msgs, only: [:create, :destroy, :new] resources :sessions, only: [:new, :create, :destroy] resources :posts, only: [:show, :create, :destroy, :new] 还有耙子路线 ![routes][1] msgs_path POST /msgs(
resources :msgs, only: [:create, :destroy, :new]
resources :sessions, only: [:new, :create, :destroy]
resources :posts, only: [:show, :create, :destroy, :new]
还有耙子路线
![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
每次我试图删除邮件时,我都没有得到与之匹配的路由[delete]“/msg.5”我不知道为什么,但资源msgs在一个路径(new#msgs#path)中有msgs#new和msgs#destroy,而资源帖子有单独的url用于删除,另一个用于新操作,我猜这是个问题,但我不知道如何解决。路由应该是
/msgs/5
。显示链接。抱歉,img有问题,我添加了文本格式。路由没有问题,这是如何生成删除链接的。那么问题出在哪里?有来自msgs_controller.rb def destroy@msg=(msg.find(params[:id])的delete方法.delete redirect_to:back endPost您单击以删除邮件的链接的代码。