title: Rails Rendering Show in Bootstrap Modal from index page
body: <p>I’m trying to render “show” via Bootstrap Modal from photos index page.
   Intended photo (unploaded with carrierwave) shows up correctly if I use the show page direct <code>(..\views\photos\show.html.erb)</code> without rendering via bootstrap modal.</p>
  
  <p>But the problem is photo doesn’t show when I try to render with <code>_show.html.erb.</code> However the fallback image shows up even with any available hard coded texts within <code>_show.html.erb.</code> Below are the snippets;</p>
  
  <pre><code>    views\photos\_show.html.erb
  
  `&lt;% if @photo.image? %&gt;
    &lt;%= image_tag @photo.image.url(:thumb2) %&gt; #this is the intended photo
    &lt;% else %&gt;
    &lt;%= image_tag("fallback/default.png") %&gt;
    &lt;% end %&gt;`
  
      Photos_controller.rb
  
  `def show
    @photo = Photo.find(params[:id])
    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml =&gt; @photo }
    end
  end`
  
  
  `views\photos\index.html.erb`  for Bootstrap modal
  
      &lt;div class =”..”&gt;
      &lt;% if photo.image? 
      &lt;%# Added Bootstrap data modal attribute %&gt;
      &lt;%= link_to (image_tag photo.image.url(:thumb)), '#showModal', 'data-toggle' =&gt; 'modal' %&gt;
  
      &lt;div class="modal fade" id="showModal" 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-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;Showing photo&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
              &lt;%= render 'show' %&gt;
            &lt;/div&gt;
            &lt;div class="modal-footer"&gt;
              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  photo.js
  
   $("#showModal").click(function(){
      $("#show").modal();
      });
  </code></pre>