title: Using group_by beginning_of_month, how do I get an event to show again in the next month?
body: <p><em>Using Rails 5.0.2</em></p>
  
  <p>I have a bunch of events, grouped by month that looks like this:</p>
  
  <hr>
  
  <h2><strong>April</strong></h2>
  
  <p><strong>Event 1</strong> </p>
  
  <p><em>23 April - 24 April</em></p>
  
  <p><strong>Event 2</strong> </p>
  
  <p><em>28 April - 22 June</em></p>
  
  <hr>
  
  <h2><strong>May</strong></h2>
  
  <p><strong>Event 3</strong></p>
  
  <p><em>4 May - 5 May</em></p>
  
  <hr>
  
  <p>The problem is, some events go for ages! E.g. Event 2 starts 23 April but finishes 22 June. </p>
  
  <p>How would I get the event item to show up again in the next month(s)?</p>
  
  <p>Current working code:</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>@monthly = @events.group_by { |t| t.start_date.beginning_of_month }
  </code></pre>
  
  <p><strong>Index view:</strong></p>
  
  <pre><code>&lt;% @monthly.sort.each do |month, event| %&gt;
    &lt;h2&gt;&lt;%= month.strftime('%B') %&gt;&lt;/h2&gt;
  
      &lt;% for event in event %&gt;
  
        &lt;li&gt;&lt;%= event.title %&gt;&lt;/li&gt;
        &lt;%= event.start_date %&gt;
        &lt;%= event.end_date %&gt;
  
      &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Thanks ya'll!</p>