阅读背景:

在RoR 4中使用validations的正则表达式。

来源:互联网 

There is the following code:

有以下代码:

class Product < ActiveRecord::Base
  validates :title, :description, :image_url, presence: true
  validates :price, numericality: {greater_than_or_equal_to: 0.01}
  validates :title, uniqueness: true
  validates :image_url, allow_blank: true, format: {
      with: %r{\.(gif|jpg|png)$}i,
      message: 'URL must point to GIT/JPG/PNG pictures'
  }
end
class P



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: