I make ruby on the rails archive blog. The backend works fine, but the year is displayed separately, as you can see in the image below.

As you can see in the picture above, come separately. But if I give the blog in the same month, it works fine, as you can see in the month august 2014(accident, policy), but not for 2014.
This is the controller
@posts_by_month = Cutting.find(:all, :order => "date DESC").group_by { |post| post.date.beginning_of_month }
view
<div class="easy-tree" style="float:left;width:300px;background: #aaaaaa;">
<%# @post_months.sort.reverse.each do |month, posts| %>
<%@posts_by_month.each do |month, posts|%>
<ul>
<li><%=h month.strftime("%G")%>
<ul>
<li><%=h month.strftime("%B") %>
<ul>
<% for post in posts %>
<li style="background: #aaaaaa;"class="getid" name ="<%=post.id%>"><%=h link_to post.subject%></li>
<% end %>
</ul>
</li>
</ul>
</li>
</ul>
<% end %>
</div>
I use easy-tree to get ui for
source
share