报错信息如下
ArgumentError: The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
报错原因如下
我写了个邮箱验证,正则中用到了标志一行开头结尾 (^) 和 ($)
validates :email, :presence => true, :uniqueness => true, :format=> {:with => /^\w+@\w+\.\w+$/},:length => {:maximum => 40}
解决方法如下
validates :email, :presence => true, :uniqueness => true, :format=> {:with => /^\w+@\w+\.\w+$/,:multiline => true},:length => {:maximum => 40}