rails validate uniqueness multiple columns

rails 2

1
validates_uniqueness_of :user_id, scope: [:friend_id, :something_else]

rails 3

1
validates :user_id, :uniqueness => {:scope => [:friend_id, :something_else]}