Ruby on rails 为什么图像选项卡的行为不一致?
我有一个视图,我试图在其中渲染一些图像。 图像的路径都是从数据库动态派生的。 问题是,我跟踪的图像选项卡有时会渲染 “资产/图像路径” 而有些时候 “图像/图像路径”Ruby on rails 为什么图像选项卡的行为不一致?,ruby-on-rails,Ruby On Rails,我有一个视图,我试图在其中渲染一些图像。 图像的路径都是从数据库动态派生的。 问题是,我跟踪的图像选项卡有时会渲染 “资产/图像路径” 而有些时候 “图像/图像路径” <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 @at
<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 %>
1 %>
2 %>
3 %>
4 %>
<代码>你能和我们共享代码吗?你应该考虑为你的块使用一个部分,或者至少循环使用它们,而不仅仅是硬编码它们。