I have a basic ActiveRecord model in which I have two fields that I would like to test. The requirement is that at least one of the fields must have a value. Both can make a difference, but at least one needs a value.
How to express it with
validates_presence_of
expression? For instance:
validates_presence_of :main_file validates_presence_of :alt_file
I do not want an error to occur if only one of them is empty, only if both of them are empty.
source share