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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -