Skip to content

Instantly share code, notes, and snippets.

@mneumegen
Created August 4, 2011 22:42
Show Gist options
  • Save mneumegen/1126481 to your computer and use it in GitHub Desktop.
Save mneumegen/1126481 to your computer and use it in GitHub Desktop.
Not Friends
User.joins("LEFT OUTER JOIN friendships ON \
(friendships.user_id = #{current_user.id} AND friendships.friend_id = users.id) OR \
(friendships.user_id = users.id AND friendships.friend_id = #{current_user.id})")
.where("friendships.id IS NULL")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment