validate :disease_or_custom_disease
#...
private
def disease_or_custom_disease
custom_disease.blank? ^ disease_id.blank?
end
Last active
May 17, 2019 19:13
-
-
Save benoror/acbcd7ae816eb2e57463240c6bda988c to your computer and use it in GitHub Desktop.
Rails Model XOR Validation for "Custom" fields
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment