Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何将内容提要呈现到多个列中?_Ruby On Rails_Partial_Renderpartial - Fatal编程技术网

Ruby on rails 如何将内容提要呈现到多个列中?

Ruby on rails 如何将内容提要呈现到多个列中?,ruby-on-rails,partial,renderpartial,Ruby On Rails,Partial,Renderpartial,我是编程新手,刚刚完成RailsTutorial,现在正尝试使用Rails构建Pinterest类型的站点 我希望主站点能够通过多列以无限循环的方式显示项目,如: 123445 678910 我有我想要的布局,但不知道如何将内容提要分解为多个div home.html.erb(我知道这是错误的) ... _feed.html.erb <% if @feed_items.any? %> <%= render :partial => 'shared/feed_ite

我是编程新手,刚刚完成RailsTutorial,现在正尝试使用Rails构建Pinterest类型的站点

我希望主站点能够通过多列以无限循环的方式显示项目,如:

123445 678910

我有我想要的布局,但不知道如何将内容提要分解为多个div

home.html.erb(我知道这是错误的)


...
_feed.html.erb

<% if @feed_items.any? %>
  <%= render :partial => 'shared/feed_item', :collection => @feed_items %>
<% end %>

“共享/feed\u items',:collection=>@feed\u items%>
_feed_item.html.erb

<div class="news">
    <div class="comments">
        <%= wrap(feed_item.content) %>
    </div>
    <div class="stats">
        #Likes, #Comments, #Repins
    </div>
    <div class="points">
    <%= link_to feed_item.user.name, feed_item.user %>
    </div>
    <div class="author">
    Posted <%= time_ago_in_words(feed_item.created_at) %> ago.
    </div>
</div>
<% if current_user?(feed_item.user) %>
  <div>
    <%= link_to "delete", feed_item, :method => :delete,
                                     :confirm => "You sure?",
                                     :title => feed_item.content %>
  </div>
<% end %>

#喜欢、评论、报告
五年前发的。
:删除,
:confirm=>“确定吗?”,
:title=>feed\u item.content%>

Ryan Bates向您展示了如何做到这一点:

以下是代码摘要:

<table>
<% @tasks.in_groups_of(5, false) do |row_tasks| %>
  <tr>
    <% for task in row_tasks %>
      <td><%= task.name %></td>
    <% end %>
  </tr>
<% end %>
</table>

这似乎很适合我:

<div class="container-fluid">
  <% @buildings.each do |building| %>
    <div class="col-md-3">
        <%= building.name %>
    </div>
  <% end %>
</div>

<div class="container-fluid">
  <% @buildings.each do |building| %>
    <div class="col-md-3">
        <%= building.name %>
    </div>
  <% end %>
</div>