I have a loop that I iterate through in my view.
<%
coll.each do |itm|
puts(itm.value)
end
%>
How do I render the itm.value without using a <%= %> tag? Should puts
not work?
Joerg
P.S. There is a good enough reason for me wanting to do this
I have a loop that I iterate through in my view.
<%
coll.each do |itm|
puts(itm.value)
end
%>
How do I render the itm.value without using a <%= %> tag? Should puts
not work?
Joerg
P.S. There is a good enough reason for me wanting to do this
Joerg D. wrote:
Joerg
P.S. There is a good enough reason for me wanting to do this
<% coll.each do |itm| -%>
<%= itm.value %>
<% end -%>
â
Arie Kusuma A. A.K.A Arie A.K.A ariekeren / YM! = riyari3
http://ariekusumaatmaja.wordpress.com
Letâs build Ruby Indonesia stronger
Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos # Indonesia Ruby Society
500 baris di PHP dkk VS 1 baris di Ruby dkk
300 baris di Java dkk VS 1 baris di Ruby dkk
Macih ngotot pake (as|ph)p? haree geneee???
Buat yang pake Ruby, nyesel kan lu pake Ruby!!! kenapa ga dari dulu?!
You canât use puts in views.
What is it youâre trying to do? Youâll have to give us the good enough
reason i think :0)
Steve
<%= coll.collect(&:value).join %>
You can use the âconcatâ method instead of âputsâ:
<%
coll.each do |itm|
concat(itm.value, binding)
end
%>
Cheers,
-DF
Hi â
On Wed, 31 May 2006, Joerg D. wrote:
I have a loop that I iterate through in my view.
<%
coll.each do |itm|
puts(itm.value)
end
%>How do I render the itm.value without using a <%= %> tag? Should puts
not work?
puts doesnât append its arguments to the _erbout variable, which is
where erb accumulates its output.
You could do:
<% coll.each {|itm| _erbout << itm.value } %>
or something like that, though thatâs really what <%= %> is for
David
â
David A. Black ([email protected])
Ruby and Rails consultancy and training
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs