I have a Friend model: user_id, friend_id, status
How can I add a validation to the friend model that prevents a user (user_id) from friending themselves (friend_id)… something like user_id does not equal friend_id?
Suggestions? Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps something like this will work (note: semi-pseudo code)
This Rails Guide section may prove helpful.