Conversation between two users
valekar opened this issue · comments
srinivas valekar commented
Is there a way to find the conversations between two users?
Thanks in advance
Piotr Niełacny commented
@alice = User.first
@bob = User.last
messages_from_bob = @alice.messages.are_from(@bob)
messages_to_alice = @bob.messages.are_from(@alice)
[messages_from_bob + messages_to_alice].sort_by(&:created_at)
@valekar this is the answer to your question?
Piotr Niełacny commented
@valekar please re-open in case on any questions.