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 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/CADGZSSeRE%2BwGs%2BR1RKsGXT%2Bgreb64cCGhDxwezwrAwnGW%2BrOcw%40mail.gmail.com.

Reply via email to