On Sunday, March 22, 2020 at 10:19:42 AM UTC-7, Petr Kaleta wrote: > > To maintain consistency auto_validations plugin should also have something > like validation_helper's `from` option. >
auto_validations does support what you want (it uses validation_helpers to do the validations), but it defaults to using :from => :values since June 2015 (see commit d883a79c004bdeebf8b75e179e2f1380a434df9c for details). You can override this using the :not_null and :explicit_not_null plugin options, as explained in the plugin documentation. Note that if you just fix the auto_validations issue but don't add an entry to the model instance's values, it will probably fail when you insert since the database column doesn't have a default set. Fixing the database schema is best fix, and that's the approach you should use if you have the ability to modify the database schema. If you can't do that, setting the value in before_validation is the next best fix. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/d82f7d0a-032c-4bf3-a512-2fc124ddcd94%40googlegroups.com.
