【发布时间】:2013-08-28 23:27:14
【问题描述】:
如果确实存在另一个字段,我如何验证回形针附件是否不存在?我试过了:
validates_attachment :img, presence: false, if: :some_other_field?
def some_other_field?
some_other_field
end
【问题讨论】:
-
这是我确定的,但我仍在寻找更优雅的方式:
validates :img_file_name, absence: true, if: :some_other_field?
标签: ruby-on-rails validation activerecord paperclip paperclip-validation