Usually the field 'kind' should be allowed blank. but if it is not blank, the value should included in ['a', 'b']
validates_inclusion_of :kind, :in => ['a', 'b'], :allow_nil => true
The code does not work?
This syntax will perform inclusion validation while allowing nils:
validates :kind, :inclusion => { :in => ['a', 'b'] }, :allow_nil => true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With