title: Render page rails, modal
body: <p>I am currently trying to optimize rendering a page in ruby on rails.</p>
  
  <p>I have a question, is there a way to make a page, only render another page when a link (href) associated to it is clicked.</p>
  
  <p>some codes in index.html.erb:</p>
  
  <pre><code>.....   
  .....
  &lt;h4&gt;
    &lt;%= item.name %&gt;
    &lt;br/&gt;&lt;a href="#&lt;%=itemt.id%&gt;_item_modal"&gt;Details&lt;/a&gt;
  &lt;/h4&gt;
  
  &lt;div id="&lt;%=item.id%&gt;_item_modal" class="modal fullscreen"&gt;
    &lt;div class="item-modal"&gt;
      &lt;%=render item%&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  .....
  .....   
  </code></pre>
  
  <p>In code above, I am using modal. So that when the link is clicked, _item.html.erb will be shown appear in a smaller page. Similar like a popup. </p>
  
  <p>When index.html.erb is loaded, then all codes inside _item.html.erb will also be loaded automatically and all queries inside will be executed because of </p>
  
  <pre><code>&lt;%render item%&gt; 
  </code></pre>
  
  <p>code.</p>
  
  <p>What I want is, I don't want index.html.erb also render all item inside _item.html.erb page unless I click "Details" button.</p>
  
  <pre><code>&lt;br/&gt;&lt;a href="#&lt;%=itemt.id%&gt;_item_modal"&gt;Details&lt;/a&gt;
  </code></pre>
  
  <p>I think by doing this think, I can save some amount of time when a user requests for item page, because the system doesn't need to retrieve all information which are not yet required.</p>
  
  <p>Could you guys help me?</p>
  
  <p>Please let me know if you need another information.</p>