Looping in .xml.builder

In my show.xml.builder I have following code.

xml.events {

<% @events.each do |event| %>
xml.event event.name
xml.id event.id
<% end %>
}

But the above code doesn’t work. Anyone knows how to incorporate looping
in .xml.builder file.

Thanks

On 23 Apr 2008, at 05:46, Neeraj K. wrote:

}

But the above code doesn’t work. Anyone knows how to incorporate
looping
in .xml.builder file.

builder isn’t erb: there are no <% or <%=

xml.events {
@events.each do |event|
xml.event event.name
xml.id event.id
end
}
should work (although i suspect that’s not the output you wanted.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs