Ruby on rails Rails验证-:无选项
我正在尝试(不幸地失败)将Desive与omniauth结合到我的Rails 4应用程序中 我目前的工作是让本教程中概述的系统正常工作 我目前遇到的问题是一个验证错误,它阻止服务器启动 我已将此验证包括在我的用户模型中:Ruby on rails Rails验证-:无选项,ruby-on-rails,regex,validation,devise,omniauth,Ruby On Rails,Regex,Validation,Devise,Omniauth,我正在尝试(不幸地失败)将Desive与omniauth结合到我的Rails 4应用程序中 我目前的工作是让本教程中概述的系统正常工作 我目前遇到的问题是一个验证错误,它阻止服务器启动 我已将此验证包括在我的用户模型中: validates_format_of :email, :without => TEMP_EMAIL_REGEX, on: :update 尝试启动服务器时,出现以下错误: Exiting /Users/.rvm/gems/ruby-2.2.2/gems/acti
validates_format_of :email, :without => TEMP_EMAIL_REGEX, on: :update
尝试启动服务器时,出现以下错误:
Exiting
/Users/.rvm/gems/ruby-2.2.2/gems/activemodel-4.2.4/lib/active_model/validations/format.rb:44:in `check_options_validity': A regular expression or a proc or lambda must be supplied as :without (ArgumentError)
from /Users/.rvm/gems/ruby-2.2.2/gems/activemodel-4.2.4/lib/active_model/validations/format.rb:21:in `check_validity!'
当我查看这方面的文档时,指导说明中说:
:without - Regular expression that if the attribute does not match will result in a successful validation. This can be provided as a proc or lambda returning regular expression which will be called at runtime.
我不知道这个注释意味着什么(我不理解API文档中的任何一件事——它都是以我所无法理解的复杂程度编写的)
有人能看到此验证中的错误吗?应该是
validates_format_of :email, :without => /TEMP_EMAIL_REGEX/, on: :update
您错过了regexp/
根据文件
它应该是
验证:email的格式,:nother=>/TEMP\u email\u REGEX/,on::update
您错过了regexp/