I need: availability => true on my model, if I have: length => {: minimum => 1 ,: maximum => 255}?

Does this: presence => true and checking the length on my rail model redundant? Or is there a reason to have both?

+3
source share
1 answer

Those checks do not do the same. The only difference is that if you just leave the length check check, you can still fill in the field with spaces (from 1 to 255). If there are test spaces, the character is not accepted

+3
source

Source: https://habr.com/ru/post/1783918/


All Articles