I want to add a validation in my model where I have 2 fields:
t.boolean :first
t.boolean :second
I want to ensure that when
first field is false
then
second field is always false
Is that possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do something like this in Rails3:
Edit: Forgot to mention that this example is from Railscasts: http://railscasts.com/episodes/211-validations-in-rails-3 in case you need more detailed information on this topic