title: Updating link_to data params with JQuery
body: <p>I have a link_to in rails that I want to use Jquery to update some of the data params.</p>
  
  <pre><code>&lt;script&gt;
    $('#filterrific_results').find('.btn').on('click', function(){
      var patient_id = $(this).attr('data-patient_id');
      var templates = $('.modal-body').find('a');
      templates.attr('patient_id', patient_id);
    })
  &lt;/script&gt;
  </code></pre>
  
  <p>I've tried this way:</p>
  
  <pre><code>&lt;%= link_to new_assessment_path(:template_id =&gt; template.id, :patient_id =&gt; "") do %&gt;
  </code></pre>
  
  <p>But the code doesn't seem to work because I'm adding the data attribute after the href url has already been rendered by rails.</p>
  
  <p>I've also tried:</p>
  
  <pre><code> &lt;%= link_to new_assessment_path, {:controller =&gt; "assessments", :action =&gt; "new", :template =&gt; template.id, :patient_id=&gt; patient.id} do %&gt;
  </code></pre>
  
  <p>But no luck either. What's the best way to accomplish this?</p>