Forum: Ruby on Rails collection.each { |x| puts x} in rhtml?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F0379e983ab499fac4d972494beab5c0?d=identicon&s=25 Brez! !! (brez)
on 2006-05-30 23:35
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]

?
Efe398b3b5436b0a8d4430090e8f86ea?d=identicon&s=25 seth b. (subimage)
on 2006-05-30 23:56
(Received via mailing list)
puts doesn't work in erb...

try...

<% collection.each do |x| %>
<%= x %>
<% end %>
6f7c877de704c7cc03c8a3b2dc52df92?d=identicon&s=25 Carmen --- (carmen)
on 2006-05-31 00:07
 > <% collection.each do |x| %>
> <%= x %>
> <% end %>

in your .mab:

comment.each(&:text) or whatever...
27c170f482104299af279902be0a9c26?d=identicon&s=25 Trevor Squires (Guest)
on 2006-05-31 00:11
(Received via mailing list)
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 Squires
http://somethinglearned.com
This topic is locked and can not be replied to.