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.
Brez! !. (Guest)
on 2006-05-31 01: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]

?
seth b. (Guest)
on 2006-05-31 01:56
(Received via mailing list)
puts doesn't work in erb...

try...

<% collection.each do |x| %>
<%= x %>
<% end %>
Carmen -. (Guest)
on 2006-05-31 02:07
 > <% collection.each do |x| %>
> <%= x %>
> <% end %>

in your .mab:

comment.each(&:text) or whatever...
Trevor S. (Guest)
on 2006-05-31 02: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 S.
http://somethinglearned.com
This topic is locked and can not be replied to.