title: ruby on rails + jquery datepicker
body: <ol>
  <li>I have an event calendar of recurring events.  The site admin picks starting and ending dates as well as an interval of recurrence.  So, this weekend's art festival that recurs daily from Friday to Sunday has three event instances.  Concerts in the Park happen every Thursday from early May through end of Sept and have about 20 or so event instances. </li>
  </ol>
  
  <p>I've used Ryan Bates' technique for managing multiple models with one form, as well as added the 'add another' <code>link_to_new_fields</code> method which causes a new sub-form to pop out where the user can add another date.  This really works great, but the event instances partial uses <code>date_select</code> and not the sexy jquery datepicker.  So, my question is how in my .coffee.js file do I account for innumerable event instances?  They all get a distinct id.  If I inspect them once the form loads, they do increment in a predictable fashion e.g, <code>calendar_event_calendar_event_instances_attributes_0_starts_at</code>, then ...1..., then ....2... and so on.  So, how do I account for them all in the <code>.coffee.js</code> file when calling <code>datepicker()</code>?  Seems ridiculous to make 100 identical methods just to account for them all, and that may not even be enough.  I tried generating the functions on the fly, to no avail, and I'm assuming there is likely a really smart way to do this either in the model or a helper with Ruby.</p>
  
  <ol>
  <li>Connected to this is the fact that once you click 'add another date,' the ids become tied to a timestamp in order to generate a unique id.  I get it, but I have no way of pre-loading the jQuery to know what these future ids may be.   So, how do I write a jquery method to deal with this?</li>
  </ol>
  
  <p>Any insight would be really helpful.  The datepicker works great throughout the site, but now the client is addicted to it and wants it here, too, if possible.</p>
  
  <p>Thanks,</p>
  
  <p>Steve</p>