1

我正在構建包含顯示頁面上的圖像輪播的rails 4應用程序。圖像已通過回形針和imagemagick上傳。第一個(主要)圖像附加到一個模型(列表),並且接下來的5個圖像與第二個模型「assets」相關聯,並位於數組中。使用引導程序輪播時顯示的圖像文件細節

上傳工作正常,圖像顯示在輪播中,但是當我顯示assets列表中的圖像時,圖像文件詳細信息(文件名,asset_file_size,created_at等)顯示在圖像下方。我的看法代碼:

 <div id="show-page-carousel" class="carousel slide"><!-- class of slide for animation --> 
     <div class="carousel-inner"> 
      <div class="item active"><!-- class of active since it's the first item --> 
      <center><img src= <%= @listing.image.url(:medium) %> alt="" ></center> 
      </div> 

      <%= @listing.assets.each do |asset| %> 
      <div class="item"> 
       <center><img src= <%= asset.asset.url(:medium) %> alt="" ></center> 
      </div> 
      <% end %> 
     </div><!-- /.carousel-inner --> 
      <!-- Controls --> 
      <a class="carousel-control left" href="#show-page-carousel" data-slide="prev"> 
      <span class="glyphicon glyphicon-chevron-left"></span> 
      </a> 
      <a class="carousel-control right" href="#show-page-carousel" data-slide="next"> 
      <span class="glyphicon glyphicon-chevron-right"></span> 
      </a> 
     </div> 

,在引導旋轉木馬的圖片下出現像的圖像文件的詳細信息:

[#<Asset id: 3, asset_file_name: "cathat1", asset_content_type: "application/octet-stream", asset_file_size: 79746, asset_updated_at: "2013-11-24 21:23:15", listing_id: 102, created_at: "2013-11-24 21:23:17", updated_at: "2013-11-24 21:23:17">, #<Asset id: 4, asset_file_name: "cathat7", asset_content_type: "application/octet-stream", asset_file_size: 74176, asset_updated_at: "2013-11-24 21:23:16", listing_id: 102, created_at: "2013-11-24 21:23:17", updated_at: "2013-11-24 21:23:17">] 

我在做什麼錯誤,同時調用資產塊?

由於

回答

2

問題是使用<%=用於塊:

<%= @listing.assets.each do |asset| %> 

改變到<%後,將文本消失。

相關問題