Lets say I had the following setup
class User < ActiveRecord::Base
has_many :address
accepts_nested_attributes_for :address, allow_destroy: true
end
class Address < ActiveRecord::Base
attr_accessible :house_color, :street_address
end
And for some reason, I wanted to only allow a given user to have one address of a given color.
How would I lock down? something like
validates :address.house_color.unique
Except functional....
Thanks!