ruby on rails - Conditional paperclip presence verification -
how can verify paperclip attachment not exist if field exist? tried:
validates_attachment :img, presence: false, if: :some_other_field? def some_other_field? some_other_field end
similar problem here, solution make comparison in def
validate :check_image_with_title def check_image_with_title if !ctitle.blank? , cimage.blank? #if ctitle not empty , cimage empty, add custom error message errors.add :key, "you need image go title" return false else return true end end
Comments
Post a Comment