From: David Trasbo Date: 2008-10-16T21:54:25+09:00 Subject: Re: A Ruby block question David A. Black wrote: >> How can I both use puts and make some content appear around the text >> field? > > I'm not a HAML expert, but in general, you don't want to use puts for > anything you're outputting in a template. You just want to insert > strings. I'm not sure how HAML handles string concatenation of this > kind. Phew, this got a little more complicated than I hoped. To make this understandable I'll just explain the problem. I want a method that accepts a block. Inside the method I'm using the method fields_for that also accepts a block. I want the f object provided by fields_for passed over to the block that MY method accepts, like this: fields_for_setting("site", "name") do |f| #--------------------------------------^ #This should be the f object that fields_for provides. = f.text_field :value, :index => nil I simply want to reuse the f object to make my view shorter and cleaner. Both in the method where the fields_for is used and in the view, where it should be reused. -- Posted via http://www.ruby-forum.com/.