require 'rubygems'
require 'activesupport'

# this doesn't work as expected. does anyone know why?
z = returning html="" do
  html += "stuff" 
  html += "more stuff" if true
end
p z
#>> "" 

# this works though
z = returning html=[] do
  html << "stuff" 
  html << "more_stuff" if true
end.join("\n")
p z
#>> "stuff\nmore_stuff" 

Update: Thanks DrMark, I should have done it like this: (I didn’t realize that one could use << on strings)

z = returning html="" do
  html << "stuff" 
  html << " more stuff" if true
end

actionmailer ActionView ActiveRecord activesupport agile ajax alphadecimal audio autotest BDD blocks capistrano ssh ruby console controller css dashboard widget delegate dog puppy naming name DRM email obfuscation exceptions factories factories-and-workers factory pattern filemerge find and replace finder fink fixtures fun functional testing gem git google maps haml helper helpers imagemagick Intertrust irb javascript jquery jrails logo macro math meetup model openssl OS X patch Pioneer Electronics plugin polymorphism project management prototype.js rails rails gotcha rails,patch,validations railsconf rake rmagick RSA encryption ruby ruby on rails script scrum scrum lessons rails scrumninja shoulda subversion SyncTV TDD testing textmate tips tricks unique hashes unix shell validation view yaml zebra stripes