title: Render Bootstrap modal from partial in rails
body: <p>I am attempting to clean up my code a bit by placing my modal code inside of a partial, however I am encountering problems when trying to call the modal.</p>
  
  <p>I tried the solution provided by <a href="https://stackoverflow.com/questions/8529420/how-to-show-twitter-bootstrap-modal-via-js-request-in-rails">How to show twitter bootstrap modal via JS request in rails?</a>, but if I understand correctly I have to add code to a particular controller to display the modal. That would be fine however <strong>I would like to display the modal regardless of the controller/view</strong> it is in. Is this possible?</p>
  
  <p>What I have (completely from the above question):</p>
  
  <p>current link (views/static_pages)</p>
  
  <pre><code>&lt;%= link_to "ModalTest", 'shared/testmodal', {:remote =&gt; true, 'data-toggle' =&gt; 'modal', 'data-target' =&gt; "testmodal" }%&gt;
  </code></pre>
  
  <p><strong>show.js.erb</strong> </p>
  
  <pre><code>$('.modal-body').html('&lt;%= escape_javascript(render :partial =&gt; 'shared/testmodal'%&gt;');
  $('.modal-header').remove(); 
  </code></pre>
  
  <p>previous attempt: </p>
  
  <pre><code>&lt;%= link_to "ModalTest", render(:partial =&gt; 'shared/testmodal') %&gt;
  </code></pre>