Skip to content

Instantly share code, notes, and snippets.

@domagude
Created November 12, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domagude/992316c76fb69c5606b9793c1663135f to your computer and use it in GitHub Desktop.
Save domagude/992316c76fb69c5606b9793c1663135f to your computer and use it in GitHub Desktop.
...
scope :between_users, -> (user1_id, user2_id) do
where(sender_id: user1_id, recipient_id: user2_id).or(
where(sender_id: user2_id, recipient_id: user1_id)
)
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment