Lesser Known Rails 2.2 Features

With Ruby on Rails 2.2 released, no doubt you've seen the major feature overviews. But did you know there are lots of subtle improvements? Pathfinder Development has a nice summary at Rails 2.2 For Me And For You.

My favorite new feature that I didn't know about:

Also, partials now take blocks, meaning they can act somewhat like layouts.

The partial itself can contain a yield:

<%= yield %>

Then the call to the partial can include a block:

<% render :partial => "table_partial" do %>
<%= @project.name %>
<% end %>

And the yield command invokes the block, as you would expect


Popular posts from this blog

Lists and arrays in Dart

Converting Array to List in Scala

Null-aware operators in Dart