I am just starting out in Rails, and trying to develop a simple application. I need to validate three values submitted to the application - each must meet the same validation criteria.
The validation is pretty simple: Value is valid if unqiue, null or equal to "p" or "d".
The following gets me halfway there:
validates_uniqueness_of :value1, :value2, :value3, :allow_nil => true
I think I can use :unless to check whether the value is either "p" or "d", however I can't figure out how.
I guess I am trying to combine validates_uniqueness_of with validates_inclusion_of.
Any suggestions?