In Rails 2.x you can use validations to make sure you have a unique combined value like this:
validates_uniqueness_of :husband, :scope => :wife
Bear with me. The way the validates method in ActiveModel works is to look for a Validator.
:presence => true
looks for PresenceValidator
and passes the options: true
to the validator's initializer.
I think you want
validates :husband, :presence => true, :uniqueness => {:scope => :wife}
(The uniqueness validator is actually part of ActiveRecord, not ActiveModel. It's really interesting how the developers set this up. It's quite elegant.)