title: Passing parameters on button click in Rails
body: <p>Right now, I have it so that when users pick an option from <code>collection_select</code>, a div is populated based on the <code>event_id</code> of their choice. Depending on the <code>Event</code>, there will be multiple <code>EventOption</code> shown, each with their own unique ids. (I have <code>EventOption</code> as <code>belongs_to</code> <code>Event</code>, each of which <code>has_many</code> of them.)</p>
  
  <p>This is what I have populating via JS/Ajax when they select an <code>Event</code>:</p>
  
  <pre><code>&lt;div class="center" &gt;
    &lt;h2&gt;Available Options for "&lt;%= @event.name %&gt;":&lt;/h2&gt;
      &lt;% @event.event_options.each do |e| %&gt;
        &lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;%= e.name %&gt; &lt;/p&gt;
        &lt;p&gt;&lt;strong&gt;Description:&lt;/strong&gt; &lt;%= e.description %&gt;&lt;/p&gt;
        &lt;p&gt;&lt;strong&gt;Price:&lt;/strong&gt; &lt;%= e.price %&gt;&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div class = "center row"&gt;  
    &lt;div class = "col-xs-6"&gt;
        &lt;%= link_to "Check Available Dates", root_path, :class =&gt; "button", :id =&gt; "available-dates-button" %&gt;
    &lt;/div&gt;
    &lt;div class = "col-xs-6"&gt;
       &lt;%= link_to "Book This Event Now!", book_now_path(:event =&gt; @event.id), :id =&gt; "book-now-button", :class =&gt; "button" %&gt;
  
    &lt;/div&gt;    
        &lt;hr&gt;
      &lt;% end %&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>My issue is that I can pass the <code>event_id</code> when they click the <code>Book This Event Now!</code>, but that's not what I need. I need the specific <code>:id</code> of the <code>:event_option</code> to be passed over, and I don't know how to get it from the iterated <code>.each</code> I have it coming from.</p>
  
  <p>How can I make sure that each iteration of a button that follows my <code>book_now_path</code> has a unique ID that I can use to complete their reservation?</p>