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:

<table>
<tr><td>
<%= yield %>
</td></tr>
</table>


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


Awesome!
Post a Comment

Popular posts from this blog

Converting Array to List in Scala

I ported a JavaScript app to Dart. Here's what I learned.

Minification is not enough, you need tree shaking