-1
I own a class that contains events and their start dates. I need to retrieve all records by grouping them together so that the first days are listed each time. Example:
2014-01-01, 2014-02-01, 2014-03-01, 2014-01-02, 2014-02-02, 2014-03-02, ...
I need these results to set up a calendar structure. Any help is welcome.
Follows the class.
class Headline
include Mongoid::Document
include Mongoid::Timestamps
field :start_date, type: Date
field :end_date, type: Date
end
Thank you, Jean. But my problem is that I have the following structure: https://gist.github.com/derickhoganpimenta/5ec709708d53df51a92c. This is the structure of a calendar, formed from the dates of the events. Each <tr>, represents a single date of each month. So, I have to display something like this:
<tr>
 <td>01-01</td>
 <td>01-02</td>
</tr>
<tr>
 <td>02-01</td>
 <td>02-02</td>
</tr>
So, the way I thought to solve this problem, is to group the results, always bringing the first dates, then the second dates, and so on from each month. Ideas?– Dérick Hogan Pimenta