rails/rails — pull request #5396 by sausman (2012-03-12 19:42:38+00:00)
Title: Added support for conditional fragment caching using :if and :unless options.

This allows fragment caching to be used conditionally by passing `if/unless` to the `cache` helper method. This comes in especially handy when caching forms that may contain changed values/errors.

Usage:

```erb
<% cache [ @user, 'form' ], :unless => @user.changed? do %>
<%= render partial: 'shared/error_messages', locals: {instance: @user} %>
<%= form_for @user do |f| %>

<%= f.label :name %>

<%= f.text_field :name %>

<%= f.submit %>

<% end %>
<% end %>
```