I'm using awesome_nested_set for building mail conversations. I have two mailboxes (Inbox and Sent) and now I want to build a proper conversation view. The main goal is select roots that have any descendants in target mailbox and root's last leaf for view on the conversation's list page. My message model:
class Message
belongs_to :mailbox
acts_as_nested_set
...
end
E.g. If I selected Inbox, I would want to select: roots those have any message with that belongs to Inbox. How can I do with select? Do I need to build a Conversation model that would have message_id, mailbox_id, unique_thread_number for this?