Putting a line break between posts in rails
I'm working with rails and I have gotten a bunch of posts set up. However, I am trying to put a linebreak or some whitespace in between each post. I've got all the articles to display usi开发者_开发知识库ng <%= render @articles %> onto the index page but I am unsure how to proceed to add whitespace. Any help would be greatly appreciated! Thanks!
You should loop trough the articles and add some custom HTML CSS to them.
<% @articles.each do |article| %>
<%= article %>
<%= link_to article.number, article, {:class => "artikel"} %>
<br />
<% end %>
Or add them to a proper html tag like p
<% @articles.each do |article| %>
<p><%= article %></p>
<% end %>
FYI you can also use a second partial that will be rendered by Rails between each instance of your main partial, this can be interesting depending of the complexity of your layout, but probably overkill for just a <br />
;-)
<%= render @articles, :spacer_template => "article_spacer" %>
精彩评论