0
我已經渲染了一個局部圖,它也在其中一個選項卡面板中加載了用戶最新帖子。用當地渲染局部圖
<div role="tabpanel" class="tab-pane" id="updates_panel">
<%= render :partial => "pages/update_panel", :locals => { :post => @user.latest_post } %>
</div>
首先,方法latest_post是顯示用戶「Last or Latest Post」。
def latest_post
posts.order(:created_at => :desc).first
end
但現在我意識到我需要顯示所有帖子降序,我似乎無法得到這個權利。
好像它的工作,但還沒有標籤面板下我仍然只顯示最新帖子,其餘的職位並沒有跟隨。 –