title: Pass Rails variable using link_to modal which is used in a helper
body: <p>I'm having trouble understanding how to pass in a variable to modal, so that I can use (not as an input in a form) but to use in a helper method. </p>
  
  <p>I've looked at: <a href="https://stackoverflow.com/questions/10626885/passing-data-to-a-bootstrap-modal">Passing data to a bootstrap modal</a> and <a href="https://stackoverflow.com/questions/10379624/how-to-pass-values-arguments-to-modal-show-function-in-bootstrap">How to pass values arguments to modal.show() function in Bootstrap</a> and <a href="http://getbootstrap.com/javascript/" rel="nofollow noreferrer">Bootstrap JavaScript</a></p>
  
  <p>Link_to modal: </p>
  
  <pre><code>&lt;%= link_to "#{comment.fname}", "#commenterModal", :class =&gt; "btn commenter", "data-toggle" =&gt; "modal", "data-id" =&gt; "4"%&gt;
  </code></pre>
  
  <p>I'm using data-id="4" to test, but I would be passing in Rails variable comment.id.</p>
  
  <p>Modal: </p>
  
  <pre><code>&lt;div id="commenterModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-dialog modal-lg"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-body" style="background-color: #F5F5F5;"&gt;
          &lt;div class="row" id="commentId"&gt;
  
  
           &lt;%= getuserprofileofcommenter(commentId).bio %&gt; 
          &lt;/div&gt;
  
        &lt;div class="modal-footer"&gt;
          &lt;button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"&gt;OK&lt;/button&gt;
        &lt;/div&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>$(document).ready(function() {
      $('#commenterModal').on('show.bs.modal', function(event) {
          $("#commentId").val($(event.relatedTarget).data('id'));
      });
  });
  </code></pre>
  
  <p>I know I'm not understanding this correctly. But I'm trying to take this instance when I click on the link_to, pass the variable (comment.id) in to the modal so I can use it when I call the helper method "getuserprofileofcommenter(commentId)". </p>
  
  <p>Any insight would help. Thank you! </p>