0
我使用Ruby on Rails爲我的網站創建了一個博客。我真的很喜歡的方式有些博客平臺對博客所有帖子的存檔這裏看到從Ruby的帖子列表生成博客帖子的存檔文件
我想編寫代碼來生成在Ruby中。我有一個大概的瞭解我的代碼,看到
<h6>Archive</h6>
<%
@posts.each do |post|
#Add dropdown for post year if first entry into year
#Add dropdown for post month if first entry into month
#Add post to dropdown of month under dropdown of year
end
%>
不過,我有一個很難轉換到這ERB代碼,我還是相當新的紅寶石。有人能給我一個這樣做的例子嗎?謝謝!
編輯:列表@posts排序最新到最舊