Skip to content

Instantly share code, notes, and snippets.

@radar
Forked from johncausey/gist:3038304
Created July 3, 2012 07:42
Show Gist options
  • Select an option

  • Save radar/3038312 to your computer and use it in GitHub Desktop.

Select an option

Save radar/3038312 to your computer and use it in GitHub Desktop.
Finding a record meeting two requirements
Conversation.where("(user_id = :current_user OR user_id = :other_user) AND (recipient_id = :current_user OR recipient_id = :other_user)", :current_user => current_user.id, :other_user => user.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment