【发布时间】:2013-10-02 16:04:37
【问题描述】:
我的模型 abc.rb 中有两个验证
validates_format_of :url, :with => URI::regexp(%w(http https))
validates_format_of :targetUrl, :with => URI::regexp(%w(http https))
validates_format_of :targetUrl
没有验证输入。无论我输入什么,它都接受。我在其他我有验证的模型上遇到同样的问题
validates_format_of :website, :with => URI::regexp(%w(http https))。
我无法弄清楚为什么validates_format_of :targetUrl, :with => URI::regexp(%w(http https)) 和 validates_format_of :website, :with => URI::regexp(%w(http https)) 的验证失败。
任何提示都会很有帮助。 谢谢
【问题讨论】:
标签: regex ruby-on-rails-3