From: Jacob Fugal Date: 2006-09-14T05:13:24+09:00 Subject: Re: eRB <%= On 9/13/06, Jason Roelofs wrote: > <% puts "Can't see me" %> --> nothing > > <%= puts "Can't see me" %> --> Can't see me That's wrong. When rendering an ERB template, those two constructs would be essentially equivalent. The both do the same thing: print "Can't see me" to STDOUT and add nothing to the rendered output. Using puts inside ERB does not put things into the rendered output -- it's not equivalent to PHP's echo/print. You should never need to use puts or print within ERB (unless your intent is to print diagnostics out to STDOUT while the ERB is being rendered). <% %> and <%= %> both evaluate an expression. The difference is that <%= %> includes the result of the expression (cast to a string using to_s) in the rendered output. The result of the expression: puts "Can't see me" is nil, since puts always returns nil. nil.to_s is an empty string, so even with the <%= %> form, nothing is added to the rendered output. What you want to do instead is just leave off the puts: Nothing added: <% "Can't see me" %> But printed here: <%= "Can see me" %> Jacob Fugal