3

is there something like:


validates_value_of :verified,:with=>1

to validate the boolean field on the model?

2 Answers 2

5

If you want it to always be true, use validates_acceptance_of. If you want it be either true or false, use validates_inclusion_of.

validates_acceptance_of :verified
validates_inclusion_of :verified, :in => [ true, false ]
Sign up to request clarification or add additional context in comments.

Comments

2

See validates_inclusion_of:

validates_inclusion_of :verified, :in => [1]

in your case

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.