title: rails, locals not passing to bootstrap modal partial
body: <p>Okay so some weird stuff is going on with passing some local variables to a partial using the bootstrap modal feature.</p>
  
  <p>I'm creating a calendar in a table. Each table cell represents a date in the month. In each of these cells is a button with the date for that cell marking it. The idea is when this button is clicked a modal will open up displaying a list of clients that have tasks that day to be done.</p>
  
  <p>Here is my <code>views/jobs/index.html.erb</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;% count = 0 %&gt;
    &lt;% 5.times do %&gt;
      &lt;tr&gt;
        &lt;% 7.times do %&gt;
          &lt;td&gt;
            &lt;% date = @calender_days[count] %&gt;
            &lt;% client_set = create_client_set(date) %&gt;
            &lt;%= render partial: 'day', locals: {jobs: @jobs, count: count, date: date, client_set: client_set} %&gt;
            &lt;% client_set[0..2].each do |client| %&gt;
              &lt;%= User.find(client).username %&gt;&lt;br /&gt;
            &lt;% end %&gt;
            &lt;% count += 1 %&gt;
          &lt;/td&gt;
        &lt;% end %&gt;
      &lt;/tr&gt;
    &lt;% end %&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is the partial referenced in the render, my <code>views/jobs/_day.html.erb</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="button" class="align-text-bottom btn btn-primary btn-xs" data-toggle="modal" data-target="#day-tasks"&gt;
    &lt;%= date.strftime('%d') %&gt;
  &lt;/button&gt;
  &lt;div class="modal fade" id="day-tasks" tabindex="-1" role="dialog" aria-labelledby="day-tasks-Label" aria-hidden="true"&gt;
    &lt;div class="modal-dialog" role="document"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;h4 class="modal-title" id="day-tasks-ModalLabel"&gt;&lt;%= date.strftime('%m/%d') %&gt;&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;%= count %&gt;
          &lt;% client_set.each do |client| %&gt;
            &lt;h5&gt;&lt;%= User.find(client).username %&gt;&lt;/h5&gt;
          &lt;% end %&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="align-text-bottom btn btn-secondary" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now the weird thing is this: <code>&lt;%= date.strftime('%d') %&gt;</code> for the button at the top of the modal evaluates correctly, where <code>date = @calender_days[count]</code> yet <code>&lt;%= count %&gt;</code> in the <code>modal body</code> <a href="https://i.stack.imgur.com/greoU.jpg" rel="nofollow noreferrer">evaluates to 0</a> across the whole calendar.  Notice also that <code>&lt;%= date.strftime('%m/%d') %&gt;</code> in the <code>modal-title</code> evaluates to the first day in the calendar. So the partial is getting the values with the button receiving the correct values but for some reason the modal isn't getting them.</p>
  
  <p>I'm really stumped, it makes no sense. Thank you all in advance for your help!</p>