html - Erb: How to make a block repeat horizontally? -
if have block of following format:
<% @model.each |f| %> <%= f.name %> <%= image_tag("some_picture.jpg") %> <br> <% end %>
how repeat horizontally, instead of vertically? if list long enough reach end of containing div, continue line down, normal html text.
this concatenates names array using array#join single space between them:
<%= @model.map(&:name).join(' ') %>
wrapping within paragraph element give looking for:
<%= content_tag(:p, @model.map(&:name).join(' ')) %>
Comments
Post a Comment