📜  rails 验证是否存在 - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:46.855000             🧑  作者: Mango

代码示例1
validates_format_of :avatar_file_name, 
 :with=>/\.(jpeg|jpg|png|gif)$/i, 
 :message=> I18n.t("..."), 
 :on => :update,
 :if => lambda{ |object| object.avatar_file_name.present? }