LTe / acts-as-messageable

Gem that allows communication between the models.

Home Page:http://lte.github.io/acts-as-messageable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conversation between two users

valekar opened this issue · comments

Is there a way to find the conversations between two users?

Thanks in advance

@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?

@valekar please re-open in case on any questions.