# Case .. when in view

**URL:** <https://www.ruby-forum.com/t/case-when-in-view/112095>\
**Category:** Rails\
**Created:** [August 15, 2007, 11:06am UTC](https://www.ruby-forum.com/t/case-when-in-view/112095 "2007-08-15T11:06:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/9f8e36/32.png) [@xinit](https://www.ruby-forum.com/u/xinit)\
**Post date:** [August 15, 2007, 11:06am UTC](https://www.ruby-forum.com/t/case-when-in-view/112095/1 "2007-08-15T11:06:48Z")

</div>

I noticed something odd:

In a view, i’m using the case/when, but the strange thing is that  
rails/ruby can’t seem to handle whitespace in front of the “when”  
statement:

```
      <% when :string then -%>

```

generates:

compile error  
script/…/config/…/app/views/inside/admin/\_form.rhtml:26: parse error,  
unexpected tIDENTIFIER, expecting kWHEN  
\_erbout.concat " "; when :string then  
^

allthough

\<% when :string then -%\>

works…

Seems like a bug to me…
