Cannot create a new "inactive" project
TianweiXing opened this issue · comments
swd commented
Trying to create a new project, the "if active" box must be checked.
Bo-Jhang Ho commented
Just want to describe the problem here in terms of RoR code, when we declare a binary (boolean) attribute and want to apply a validator on top of it, we should use validates_inclusion_of:
instead of validates:
. The following is correct:
validates_inclusion_of :useurlphoto, :in => [true, false], message: ": Missing photo source: by url or by uploading"
The following is incorrect:
validates :isactive, presence: {message: ": Missing active/nonactive status"}