通过引导轮播视图渲染多对多图像

时间:2013-04-01 08:00:50

标签: ruby-on-rails twitter-bootstrap carousel

我正在尝试渲染这个,我在浏览器中返回的唯一内容是:[]

<div>
<% @team.player.each do |p| %>
  <%= render :template=>"images/carousel", :locals => { :images => p.images, :id=> "p-images-" + p.id.to_s } %> 
<% end %>
</div>

这是我的轮播

的模板
<div id="<%= id %>" class="carousel slide">


  <div class="carousel-inner">
    <% images.each_with_index do |i, index| %>
    <div class="item thumbnail<% if index == 0 %> active<% end %>">
      <img class="img-rounded" src="<%= i.image.url %>" />
    </div>
    <% end %>
  </div>

  <a class="carousel-control left" href="#<%= id %>" data-slide="prev">&lsaquo;</a>
  <a class="carousel-control right" href="#<%= id %>" data-slide="next">&rsaquo;</a>

      <ol class="carousel-indicators">
        <% images.each_with_index do |i, index| %>
          <li data-target="#<%= id %>" data-slide-to="<%= index %>"<% if index == 0 %> class="active"<% end %>></li>
        <% end %>
      </ol>
</div>

0 个答案:

没有答案