Here is the original code:
unless (adult_full_price? && adult_price? && !child_full_price? && !child_price?) ||
(child_full_price? && child_price? && !adult_full_price? && !adult_price?) ||
(adult_full_price? && adult_price? && child_full_price? && child_price?)
errors.add('...')
end
I used four conditions:
1. adult_full_price? && adult_price?
2. !adult_full_price? && !adult_price?
3. child_full_price? && child_price?
4. !child_full_price? && !child_price?
And I want to add four more new conditions:
1. student_full_price? && student_price?
2. !student_full_price? && !student_price?
3. senior_full_price? && senior_price?
4. !senior_full_price? && !senior_price?
There won't be two conditions of adult at the same time, so as child, student and senior.
For example, when adult_full_price? && adult_price? exists, !adult_full_price? && !adult_price? shall not exist.
Is there an easier way to get every combinations out of these conditions?