Validate not nil, min and max for a string
The following validation code doesn't work:
In the documentation I can only find examples for
allow_nil? or constraints: [min_length: 1, max_length: 255] but none where both are combined.
How do I have to change the code to work?4 Replies
How can I use the
do ... end syntax with this validation?
the
do end is an alternative syntax, you have the required arguments first and then the options as a keyword list last. instead of passing it as a keyword list you can also use the do end block.
Thanks @barnabasj !