Collection.each { |x| puts x} in rhtml?


#1

Been trying to use the short format for a collection in rhtml, i.e.

<% collection.each {|x| puts x} %>

Doesn’t seem to work though [outputs nothing]

?


#2

puts doesn’t work in erb…

try…

<% collection.each do |x| %>
<%= x %>
<% end %>


#3

<% collection.each do |x| %>
<%= x %>
<% end %>

in your .mab:

comment.each(&:text) or whatever…


#4

On 30-May-06, at 2:35 PM, brez! !! wrote:

Been trying to use the short format for a collection in rhtml, i.e.

<% collection.each {|x| puts x} %>

Doesn’t seem to work though [outputs nothing]

?

Hey,

how about <%= collection.join %>

Trevor

Trevor S.
http://somethinglearned.com