Mik*_*bee 1 ruby mysql reporting ruby-on-rails ruport
我正在尝试评估Ruport在我的Rails应用程序中使用,但我不确定如何使用日期/时间戳记拍摄一系列记录并通过Ruport的分组功能对它们进行分组.
如果Ruport没有意义,我会接受其他/更好的方法来做同样的分组.
没有ruport:
<% @posts.group_by {|p| p.created_at.at_beginning_of_day }.each do |day, posts| %>
<h2><%= day.strftime("something...") %></h2>
<% posts.each do |post| %>
do stuff with `post`.
<% end %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
使用at_beginning_of_month,at_beginning_of_week等等,这取决于你想用什么组.
| 归档时间: |
|
| 查看次数: |
1428 次 |
| 最近记录: |