首页 \ 问答 \ Rails,Devise,Validatable无法正常工作?(Rails, Devise, Validatable not working?)

Rails,Devise,Validatable无法正常工作?(Rails, Devise, Validatable not working?)

我有Devise设置:在我的简单应用程序上有效,但我似乎无法获得注册注册表单,如果它发现错误就停止。

User.rb:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
...
end

截至目前,我有一个标准名称/电子邮件/密码/年龄字段的注册表单,当我提交没有失败的表单时,一切正常。

但是,如果我尝试创建一个我知道会失败的新用户(例如,创建一个已经存在电子邮件的用户),它仍然会尝试创建用户,而不是重定向回到注册表单,它将继续加载下一页,就好像它是一个有效的用户! 当然,在这一点上,我收到一个错误,因为它试图加载一个包含'current_user'代码的页面,并且用户不存在。

我甚至在哪里开始追踪这个? 不确定这是我安装Devise的方式,还是其他什么? 请帮忙。 谢谢!


I have Devise set up with :validatable on my simple app, but I can't seem to get the registration sign-up form to stop if it caught an error.

User.rb:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
...
end

As of now, I have a sign-up form with standard name/email/password/age fields, and everything works fine when I submit the form that doesn't fail.

But, if I try to create a new user that I know would fail (ex. create a user with an e-mail that already exists), it will still try to create the user, and instead of redirecting back to the sign-up form, it will continue to load the next page as if it was a valid user! Of course, at this point, I get an error because it tries to load up a page with 'current_user' code, and the user doesn't exist.

Where do I even begin to track this down? Not sure if it's the way I installed Devise, or something else?? Please help. Thanks!


原文:https://stackoverflow.com/questions/36024297
更新时间:2022-06-20 15:06

最新回答

命令格式为:man 你所想查询的命令比如想知道ls命令的作用跟用法:man ls
要想要中文改下语系就可以输入:lang=zh_cn.big5就可以,字符终端man的使用格式:man 要查看的对象我的linux上如:man date   会有下图的信息,具体参数建议查看资料。
会得到

相关问答

更多
  • 要想要中文改下语系就可以输入:LANG=zh_CN.big5就可以,字符终端man的使用格式:man 要查看的对象我的linux上如:man date 会有下图的信息,具体参数建议查看资料。 会得到
  • 直接man curses
  • 如果你是初学者 你看的不是Jqueryui 和jquery easyui, JqueryUI和jquery easyui 是Jquery的插件. 你应该看Jquery api才对。 Jquery API 1.4以上的中文版网上都有。
  • 其实lz你只要安装linux时选择中文语言再安装上kde系统,那么你在图形桌面那终端使用man + 命令或者文件那么就会有手册了..系统自带的无需下载....不过汉化率比较差...基本上都是一些常规的命令有翻译...大部分都没有.....如果man中没有翻译那么可能使用:命令空格--help这些会列出常规的参数可能会有中文翻译。
  • http://www.aybook.cn/soft/softdown.asp?softid=1981
  • 离线的没有,我都是看这个http://www.css88.com/doc/zeptojs_api/。大部分跟jquery是一样的,可以参考jquery的离线手册
  • 可以把系统语言设置为 英文,然后安装 英文的语言包,这样man就都回中文了。
  • mfc类库中文手册[2021-05-18]

    已发
  • 有命令行中输入man XXX XXX是包的名称或是命令名称或是程序库名称 如:man glibc就是glibc(GCC c lib)库中的函数介绍 要看有什么程序包用新立得打开可以搜索,点击下面就有描述 有些程序有开发包就会有dev包。如openoffice-dev就是开发openoffice插件的开发包,包含有相关函数库
  • 收藏,学习下。多谢楼主哈

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)