我有兩種不同類型的對話,開始和加入。我想把它們放在同一個流中,從最新的到最新的到最底層。也就是說,我希望它們混合在一起,這樣無論是由用戶啓動還是由用戶加入(即由另一個用戶啓動),最新的對話都處於最佳狀態。呈現最新的兩個部分在同一個流
從我的控制器:
def conversations
@user = current_user
@joined_conversations = @user.received_meeting_requests.paginate(page: params[:page], :conditions => ['state = ?', 'replied'])
@started_conversations = @user.sent_meeting_requests.paginate(page: params[:page], :conditions => ['state = ?', 'replied'])
end
在我看來,我的渲染這樣的:
<ol class="meetings">
<%= render @started_conversations %>
<%= render @joined_conversations %>
</ol>
<%= will_paginate @started_conversations %>
<%= will_paginate @joined_conversations %>
<% end %>
因此,即使最老的開始談話將是最新加入談話的上方。如何渲染這兩個對象以使它們混合在一起,即最新開始或已加入的對話將始終處於頂層?謝謝!