muhammadn
muhammadn

Reputation: 330

Loop between a <div> and a <div title="Page"> in rails

I have looked at cycle() but it has problem formatting when i do:

<%= cycle('<div title="Pages">', <div>) %>

I have done this:

<div id="mybook">
  <% @print.document_images_list.each do |image| %>
  <%= cycle('<div title="Pages">', '<div>') %>
      <%= image_tag image %>
  </div>

  <% end %>
</div>
<% end %>

and the HTML output shows something like:

 &lt;div title=&quot;Pages&quot;&gt;

and

  &lt;div&gt;

I have looked at .each_slice enumerator and (1..x).each but i am not sure how to do about this.

(I need it without "title" in div as well)

Upvotes: 1

Views: 77

Answers (1)

RadBrad
RadBrad

Reputation: 7304

Try

 <%= raw cycle('<div title="Pages">', '<div>') %>

or

 <%= cycle('<div title="Pages">', '<div>').html_safe %>

Upvotes: 1

Related Questions