Skip to content

Instantly share code, notes, and snippets.

@akahn
Created June 22, 2015 15:17
Show Gist options
  • Save akahn/b52d42b82437dfd02786 to your computer and use it in GitHub Desktop.
Save akahn/b52d42b82437dfd02786 to your computer and use it in GitHub Desktop.
Sequel errors added in after_validation don't prevent save
# Validations added in an instance hook:
model.after_validation_hook { model.errors.add("random_attribute", 'Unrecognized attribute') }
# Later:
> model.valid?
=> false
> model.errors
=> {"random_attribute"=>["Unrecognized attribute"]}
> model.save
# Persists the record even though the instance is invalid!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment