HTTPS clone URL
Subversion checkout URL
Please sign in to comment.
Add :allow_missing validation option, useful if the database provides…
… a good default The RDoc has a good description for this option: Whether to skip the validation if the attribute isn't a key in the values hash. This is different from allow_nil, because Sequel only sends the attributes in the values when doing an insert or update. If the attribute is not present, Sequel doesn't specify it, so the database will use the table's default value. This is different from having an attribute in values with a value of nil, which Sequel will send as NULL. If your database table has a non NULL default, this may be a good option to use. You don't want to use allow_nil, because if the attribute is in values but has a value nil, Sequel will attempt to insert a NULL value into the database, instead of using the database's default. This option is available for all of the standard validations, and can be used by validates_each as well, so it works with custom validations. This commit also changes the :allow_nil and :allow_blank validation options so they are applied at the validates_each level generically, instead of having code for them in each of the validation methods. I removed the duplicative RDoc for these options (and the :tag option) from all of the validation methods, and added a class level RDoc notice that all validation methods also accept the options that validates_each accepts.
- Loading branch information...
Showing with 129 additions and 64 deletions.