I have a table that is modeling a friendship between two players. I'd
like it so that there can only be one record for this friendship in
the table.  I have added an index to the table to make sure that a
record is unique like so ...

id1  id2
1    2
1    2   # Error, record isn't unique

add_index(:friendships, [:friend_id1, :friend_id2], :unique => true)

I would also like to add an index to take care of the following
situation...

id1  id2
1    2
2    1   # Error, since it's the same as the first record

How would I do this?
Thanks.
Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to