0

我有一个视图,我尝试在其中渲染一些图像。图像的路径都是从数据库中动态得出的。问题是我正在跟踪的 image_tab 有时会呈现“资产/图像路径”,而其他一些时间会呈现“图像/图像路径”

<div class="col-sm-9 guess-button">
  <div class="row" id="cards">
       <div class="col-xs-2 col-sm-offset-1 .col-xs-offset-1">
      <% if @attempts && @attempts > 0 %>

          <%= image_tag @deal.at(0), class: "img-responsive"%>
      <% else %>
          <%= image_tag "cardBack.gif", class: "img-responsive"%>
      <% end %>
     </div>
     <div class="col-xs-2">
        <% if @attempts && @attempts > 1 %>
          <%= image_tag @deal.at(1), class: "img-responsive"%>
      <% else %>
          <%= image_tag "cardBack.gif", class: "img-responsive"%>
      <% end %>
     </div>
     <div class="col-xs-2">
       <% if @attempts && @attempts > 2 %>
        <%= image_tag @deal.at(2), class: "img-responsive" %>
      <% else %>
          <%= image_tag "cardBack.gif", class: "img-responsive"%>
      <% end %>
     </div>
     <div class="col-xs-2">
       <% if @attempts && @attempts > 3 %>
          <%= image_tag @deal.at(3), class: "img-responsive" %>
      <% else %>
          <%= image_tag "cardBack.gif", class: "img-responsive"%>
      <% end %>
     </div>
     <div class="col-xs-2">
       <% if @attempts && @attempts > 4 %>
         <%= image_tag @deal.at(4), class: "img-responsive"%>
      <% else %>
          <%= image_tag "cardBack.gif", class: "img-responsive"%>
      <% end %>
     </div>
  </div> <!-- ROW -->   
</div>
4

0 回答 0