Hello,
I am new to Ruby on rails and this is therefore probably trivial. Lets
say I have 3 tables - users[id,name, age, …],
interests[id,name,description, …], and finally a table
user_interests[id,user_id,interest_id] to link a user to a set of
interests. Now there is no problem to put validates_uniqueness_of :name
in the user-model to ensure that I only have one Lenny, but how do I
validate the uniqueness of Lenny’s interests in the user_interest-table?
Ie, is there a method to validate that an entry into a table is unique
in terms of several fields? Lenny -fishing, Lenny - programming OK,
whereas Lenny - fishing, Lenny - fishing would be caught?