rails/rails — pull request #7731 by wojtekmach (2012-09-22 10:12:05+00:00)
Title: Add conditional css class to content_tag

Hi,

I'm proposing to extend `content_tag` so that it accepts nested array for `class` key:

Before
======

```erb

<% @products.each_with_index do |product, i| %>
<%- css_classes = ['product']
css_classes << 'first' if i == 0 %>

<%= content_tag :li, class: css_classes do %>
<%= product.title %>
<% end %>
<% end %>

```

After
=====

```erb

<% @products.each_with_index do |product, i| %>
<%= content_tag :li, class: ['product', ['first', i == 0]] %>
<%= product.title %>
<% end %>
<% end %>

```

What do you think about it?