首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rails路由设备参数

rails路由设备参数
EN

Stack Overflow用户
提问于 2014-10-29 04:59:26
回答 1查看 63关注 0票数 0

我正在尝试修改现有的设计路由以保存参数

以下是工作路线:

代码语言:javascript
复制
  devise_for :contributors, controllers: {registrations: 'contributors/registrations', confirmations: 'contributors/confirmations'}

工作路径:

代码语言:javascript
复制
  <p><a href="<%= new_contributor_registration_path%>" class="btn btn-lg btn-primary" role="button">Create Account</a></p>

我需要能够用它传递一个参数。有没有简单的方法可以做到这一点?

我在考虑做这样的事情:

代码语言:javascript
复制
  devise_for :contributors, controllers: {registrations: 'contributors/registrations(/:contributor_type)', confirmations: 'contributors/confirmations'}

  <p><a href="<%= new_contributor_registration_path(contributor_type: 'teacher') %>" class="btn btn-lg btn-primary" role="button">Create Account</a></p>

但是不幸的是,它只返回这个错误:错误的常量名称注册(

EN

回答 1

Stack Overflow用户

发布于 2014-10-29 05:08:17

不要紧,我不需要在devise_for路由声明中放置参数。

代码语言:javascript
复制
  devise_for :contributors, controllers: {registrations: 'contributors/registrations', confirmations: 'contributors/confirmations'}

这很好地与

代码语言:javascript
复制
<p><a href="<%= new_contributor_registration_path(contributor_type: 'teacher') %>" class="btn btn-lg btn-primary" role="button">Create Account</a></p>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26618372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档