title: How to pass image to bootstrap modal window in rails 4
body: <p>I have photo index page, In that when I want to click a image that image will show in modal window. i have tried below code. i am not getting right output.</p>
  
  <pre><code>&lt;%= render 'shared_page' %&gt;
        &lt;div class="widget-content"&gt;
          &lt;%= render 'layouts/messages' %&gt;
          &lt;div class="table-responsive"&gt;
            &lt;table class='datatable table-bordered table-hover'&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                &lt;th&gt;Address&lt;/th&gt;              
                &lt;th&gt;Mobile Number&lt;/th&gt;
                &lt;th&gt;Landline Number&lt;/th&gt;
                &lt;th&gt;Image Type&lt;/th&gt;
                &lt;th&gt;Image&lt;/th&gt;
                &lt;th&gt;Actions&lt;/th&gt;              
              &lt;/tr&gt;
            &lt;/thead&gt;
  
            &lt;tbody&gt;
              &lt;% @cable_photos.each do |cable| %&gt;
                &lt;tr&gt;
                  &lt;td&gt;&lt;%= cable.address %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;%= cable.mobile_no %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;%= cable. phone_no %&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;%= cable.image_type %&gt;&lt;/td&gt;
                  &lt;td&gt; &lt;%= link_to image_tag cable.avatar.url(:thumb), data: {toggle: "modal",target: "#myModal", :id =&gt; cable.id } %&gt;&lt;/td&gt; 
                  &lt;td&gt;
                    &lt;%= link_to 'Edit', edit_cable_photo_path(cable), class: 'btn btn-default btn-xs' %&gt;
                    &lt;%= link_to cable, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger ' do %&gt;
                      &lt;i class='icon icon-remove'&gt;&lt;/i&gt;
                    &lt;% end %&gt;
                  &lt;/td&gt;
                &lt;/tr&gt;
              &lt;% end %&gt;
            &lt;/tbody&gt;
          &lt;/table&gt;
       &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
        &lt;div class="modal-dialog"&gt;
        &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
        &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
        &lt;h4 class="modal-title" id="myModalLabel"&gt;Image&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;% if params[:id].present? %&gt;
         &lt;% @cable = CablePhoto.find(data('id')) %&gt;
         &lt;%= image_tag @cable.avatar.url %&gt;
         &lt;% end %&gt;
        &lt;/div&gt;
        &lt;/div&gt;
        &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>