writing actionview wrappers?

Hi,

I want to write a method that acts like actionview's form_for method.
Meaning:

<% fancy_div do |div| %>
ruby is awesome
</div>

should produce something like:

<div class="fancy">
  <div class="inner">
    ruby is awesome
  </div>
</div>

I tried

def test
return "<div>#{yield"}</div>"
end

But this only returns the contents (the yield part) and doesn't wrap
it around the divs.
Any suggestions?
Thanks!

--Andrei

Check out Ryan Davies Railcasts. He’s done one on exactly this

http://railscasts.com/episodes/40

HTH

Daniel