rounded_box &block data = capture(&block) concat(render(:partial => "shared/rounded_box", :locals => {:data => concat()})) end And your view: <% rounded_box do %> <%= @post.body %> <% end %>
• Can clean up complex partials a lot • Keeps models the way they should be • More info at: http://www.htmltimes.com/presenters-in- Ruby-on-Rails-applications.php or http://bit.ly/vUlv
• Higher level of abstraction • Views get more readable, thus better maintainable • Beware: Big shift from ERB/Haml to Ruby • But, It’s a joy writing views again!