Validate attribute only if it present (only if user fill in it)
Some validations accept the options :allow_blank => true
or :allow_nil => true
.
If this fails, use :if condition, like this:
validates_format_of :avatar_file_name, :with=>/\.(jpeg|jpg|png|gif)$/i, :message=> I18n.t("..."), :on => :update, :if => lambda{ |object| object.avatar_file_name.present? }
But i encourage you to use allows. Much cleaner.