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
Post a Comment