Ah okey, now I understand... Hmmm as I sometimes need to decide on default value based on current instance, maybe it will be the best way to fix all of this issues by using after_initialize plugin. So I'll remove defaults_setter at all and set all those values in after_initialize hook...
Dne neděle 22. března 2020 22:32:17 UTC+1 Jeremy Evans napsal(a): > > 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 sequel-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/bdd66552-5584-4a1b-aba6-3f7af1e3d369%40googlegroups.com.