ruby-on-rails – ActionController :: UrlGenerationError:没
发布时间:2020-12-16 23:10:10 所属栏目:百科 来源:网络整理
导读:我从行%= link_to“询问用户输出”,askout_user_message_path(@user),:class =行收到无路由匹配错误“按钮”%. 这曾经在我添加宝石之前工作,但现在它停止了工作.我尝试在收集下移动,但我没有运气,因为那是以前的地方. 路线: resources :users do |user|
我从行<%= link_to“询问用户输出”,askout_user_message_path(@user),:class =>行收到无路由匹配错误“按钮”%>.
这曾经在我添加宝石之前工作,但现在它停止了工作.我尝试在收集下移动,但我没有运气,因为那是以前的地方. 路线: resources :users do |user| resources :messages do member do post :new get 'askout',action: 'askout' end end collection do get :trashbin post :empty_trash end end resources :conversations do member do post :reply post :trash post :untrash end end 旧路线: resources :users do |user| resources :messages do collection do post 'delete_multiple' get 'askout',action: 'askout' get 'reply',action: 'reply' end end end 当我添加邮箱gem时,我的路线发生了变化. 解决方法
你最好这样做:
#config/routes.rb resources :users do resources :messages do member do post :new get :askout end end collection do get :trashbin post :empty_trash end end 这会给你: users/1/messages/5/askout 我想你想要什么: #config/routes.rb resources :users do resources :messages do post :new collection do get :askout end end collection do get :trashbin post :empty_trash end end 这会给你: users/2/messages/askout 路径助手将在rake routes视图中确定 – 您应该查看它以了解您的路由被调用(允许您相应地编写它) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- oracle – DBMS_DATA_MINING.CREATE_MODEL在11.2.0.1.0 64b
- webpack、sass、react、redux的简易demo入门
- 不依赖storyboard实现ViewController跳转和传参
- c# – Windows Phone 7物理按钮重载
- React.js学习笔记之表单详解
- postgresql – Postgres在regexp_split_to_table拆分的列中
- c# – 禁用Internet Explorer控件中的上下文菜单
- LIDC-IDRI肺结节公开数据集Dicom和XML标注详解
- struct 互转 xml
- ios – 在任何具体目标中不使用依赖关系“AFNetworking(?>