Created
June 22, 2015 15:17
-
-
Save akahn/b52d42b82437dfd02786 to your computer and use it in GitHub Desktop.
Sequel errors added in after_validation don't prevent save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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