Yes, thanks, I didn't notice that in the method documentation. Em ter, 15 de dez de 2020 17:40, Jeremy Evans <[email protected]> escreveu:
> On Tue, Dec 15, 2020 at 10:52 AM Rodrigo Rosenfeld Rosas < > [email protected]> wrote: > >> Hi, I've noticed there's no option to skip the presence validation when >> using the length validation methods. I have some varchar null fields and I >> end up having to perform the conditional validation like this: >> >> if name >> validates_max_length 255, :name, message: 'Name length should be at >> most 255 chars' >> end >> >> I'd rather write: >> >> validates_max_length 255, :name, validates_presence: false, message: '...' >> >> > validates_max_length and other validation methods in > validation_helpers support the :allow_blank, :allow_missing, and :allow_nil > options, would one of those work for you? > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sequel-talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sequel-talk/bpaWPDZvVBw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sequel-talk/CADGZSSeRE%2BwGs%2BR1RKsGXT%2Bgreb64cCGhDxwezwrAwnGW%2BrOcw%40mail.gmail.com > <https://groups.google.com/d/msgid/sequel-talk/CADGZSSeRE%2BwGs%2BR1RKsGXT%2Bgreb64cCGhDxwezwrAwnGW%2BrOcw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAGmv%2BwKZijU2DeAuTnWsZqk7bEJLfn6VvJVRMQBWOX8ngxqCAg%40mail.gmail.com.
