title: Recurring Events with Existing Associations
body: <p>I have an existing <strong>live</strong> application with an <code>Event</code> model that looks like the following:</p>
  
  <pre class="lang-rb prettyprint-override"><code>class Event &lt; ActiveRecord::Base
    has_many :tickets
    has_many :orders
    has_many :products, through: :orders
    has_many :rsvps, through: :orders
  end
  </code></pre>
  
  <p>My problem is that I now need to add in the functionality that will let a user specify that the event needs to be recurring (for which they'll set a schedule).  There are a couple of approaches I've thought of as follows:</p>
  
  <ol>
  <li>Have a <code>schedule</code> and <code>parent_event</code> property on the <code>Event</code> model, for which I will trigger a background job after the event is created to create duplicate events in the DB with the <code>parent_event</code> pointing to the main event so that I can aggregate statistics on the main event (like total tickets bought, etc...).  This is the easiest route as all of the models references (<code>tickets</code>, <code>rsvps</code>, <code>orders</code>) don't need to be altered.</li>
  <li>Create a <code>Schedule</code> model that is a <code>habtm</code> relationship with events, and make <code>tickets</code>, <code>rsvps</code>, etc... belong to that instead.  So I'd be creating one event with many <code>Schedules</code> attached to it for recurring events.</li>
  </ol>
  
  <p>Option 1 seems really dirty, especially if users want to delete an event (I'd have to delete all of the duplicates then as well), but it would require the least amount of code-changes.  Option 2 seems like it could be the most scalable approach, but I feel like I may be overcomplicating this.  Any advice / examples would be appreciated.</p>