The question has surely already be asked, but I didn't find it.

I am often forced to write code like that in views:

* `<div class="<%= c ? 'my_class' : 'my_other_class' %>">`
* `<div class="<%= 'my class' if c %>">`
* `<div<%= c ? 'class="my_class"' : 'id="my_div"' %>>`

Or (the prettier way, but the less readable) :

```
<% div_inner = capture do %>
   ...
<% end %>

<% if c %>
  <div class="my_class"><%= div_inner %></div>
<% else %>
  <div><%= div_inner %></div>
<% end %>

```

A last one :

```
<% div_inner = capture do %>
   ...
<% end %>

<%= content_tag(:div, div_inner, (c ? { :class => "my_class" } : {})) %>

```

I found all this solutions syntactically dirty. I am convinced that there is a nicer way. But witch ?
Your own experiences are welcome.