div_for(record, *args, &block)
Instance Public methods
Produces a wrapper DIV element with id and class parameters that relate to the specified Active Record object. Usage example:
<%= div_for(@person, class: "foo") do %> <%= @person.name %> <% end %>
produces:
<div id="person_123" class="person foo"> Joe Bloggs </div>
You can also pass an array of Active Record objects, which will then get iterated over and yield each record as an argument for the block. For example:
<%= div_for(@people, class: "foo") do |person| %> <%= person.name %> <% end %>
produces:
<div id="person_123" class="person foo"> Joe Bloggs </div> <div id="person_124" class="person foo"> Jane Bloggs </div>
Please login to continue.