Ruby Sequel model to have validation for create and not update -



Ruby Sequel model to have validation for create and not update -

how can avoid having validation update while having create? instance:

i wish have image field have presence validation on create. want avoid in edit , assume previous value in case of no change.

note: using padrino.

in sequel, validations done @ instance level using validation_helpers plugin. utilize standard ruby conditional if want validate new objects , not existing ones:

plugin :validation_helpers def validate super validates_presence :image if new? end

ruby sequel

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -