i have trouble to user uniqness couples in my app...
I have users witch can be linked to so some contacts. I use a relation table to do my links (witch has a level attribute also - for different level of relations)
So i have users, contacts and relationships. My problem is that the couple contact_id and user_id has to be uniq (they can be linked only once).
contact.rb
has_many :relations, :dependent => :destroy
has_many :users, :through => :relations, :uniq => true
user.rb
has_many :relations, :dependent => :destroy
has_many :contacts, :through => :relations, :uniq => true
relation.rb
belongs_to :user
belongs_to :contact
I dont know if i have to use foreign_key or whatever, i just need something simple :)
cheers