From: David Trasbo Date: 2008-10-16T21:11:28+09:00 Subject: Re: A Ruby block question David A. Black wrote: > Hi -- > > On Thu, 16 Oct 2008, David Trasbo wrote: > >> can't convert nil into String >> >> That doesn't really make sence, does it? > > Actually it does, because your block contains a call to puts, and puts > always returns nil. You probably want your block just to contain a > string. Ah, I see. Let me just explain. Since I'm using Rails I am calling this method with the block in a view or a template. My template language is Haml, and this is how it's called: - fields_for_setting("site", "name") do |f| = f.label :value, "Site name", :index => nil = f.text_field :value, :index => nil The = is a short hand for puts as you pointed out. But I don't see other possibilities than using put, otherwise the text field will not show up in the view. How can I both use puts and make some content appear around the text field? -- Posted via http://www.ruby-forum.com/.