私は持っている
a = Profile.last
a.mailbox.inbox
a.mailbox.sentbox
active_conversations = [IDS OF ACTIVE CONVERSATIONS]
a.mailbox.inbox & active_conversations
必要なものの一部を返します
私が欲しい
(a.mailbox.inbox & active_conversations) および a.mailbox.sentbox
しかし、効率的に注文できるように、SQLとして必要です。('updated_at')までに注文したい
結合などを試しましたが、うまくいきません。(a.mailbox.inboxa と sentbox のクラスは
ActiveRecord::Relation::ActiveRecord_Relation_Conversation
しかし
(a.mailbox.inbox & active_conversations)
配列です
編集
a.mailbox.inbox JOINS SOMEHOW a.mailbox.sentbox のような単純なもので作業できるはずですが、理解できないようです。