为什么image_tab行为不一致?

时间:2013-09-20 18:13:38

标签: ruby-on-rails

我有一个视图,我尝试渲染一些图像。 图像的路径都是从数据库动态导出的。 问题是image_tab因为我正在追踪一些渲染     资产/ ImagePath的“ 而其他一些时候呈现     '图像/的ImagePath'

<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>

0 个答案:

没有答案