RoR中的jQuery验证(jQuery Validation in RoR)

编程入门 行业动态 更新时间:2024-10-22 14:40:50
RoR中的jQuery验证(jQuery Validation in RoR) map.check_email "users/check_email", :controller => "users", :action => "check_email" map.resources :users

在教程中,它告诉我将这添加到我的routes.rb中,但是我得到错误

undefined local variable or method `map' for #<ActionDispatch::Routing::Mapper:0x5f8f308>

我正在使用rails 3.0.9,我该如何解决这个问题?

map.check_email "users/check_email", :controller => "users", :action => "check_email" map.resources :users

In the tutorial it tells me to add this to my routes.rb but i get the error

undefined local variable or method `map' for #<ActionDispatch::Routing::Mapper:0x5f8f308>

I'm using rails 3.0.9, how do i fix this?

最满意答案

在rails 3中,你不会再使用map.resources

只是使用resources :users

请参阅本指南以了解Rails 3中的路由:

http://guides.rubyonrails.org/routing.html

如果你想为check_mail指定一个特定的路由名称,比如

www.myapp.com/check_mail你可以在你的路线中做到这一点:

match 'check_mail' => "users#check_mail"

in rails 3 you dont't use anymore map.resources

just use resources :users instead

refer to this guide for routing in Rails 3:

http://guides.rubyonrails.org/routing.html

if you want a specific route name for check_mail, like

www.myapp.com/check_mail you could do this in your routes:

match 'check_mail' => "users#check_mail"

更多推荐

本文发布于:2023-08-05 20:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1438024.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:RoR   jQuery   Validation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!