Something I keep coming across when working with Ruby on Rails view templates, is wrapping blocks of content in common DIV tags with certain properties, so I can easily style the application with CSS.
For example, a page can have multiple content boxes, and possibly a sidebar with a number of info boxes. What I used to do, was something like this:
<div id="sidebar">
<div class="infobox">
Here is some help
</div>
</div>
<div class="content_box">
<%= render :partial => "table", :locals => {:people => @people} %>
</div>
Instead, by looking at the implementaton of the content_tag_for ActionView helper, I was able to find a way to do this:
<% sidebar do %>
<% infobox do %>
Here is some help
<% end %>
<% end %>
<% content_box do %>
<%= render :partial => "table", :locals => {:people => @people} %>
<% end %>
read more »