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: '...'

Or a shorter param if you could think of a good one.

Anyway, not a big issue, but maybe it would make sense to consider such 
improvement to those length validations.

Alternatively, we could support some options to the presence validator:

validate_presence :name, max_length: 255 # or length_range: 0..255

As I said, not a big deal, just some ideas that came to my mind.

Cheers,
Rodrigo.

-- 
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/882cd8b3-48e5-4a08-a8ed-1ea6ee121487n%40googlegroups.com.

Reply via email to