Skip to Navigation | Skip to Content



Ruby case statements in ERB | March 14th, 2008

Fail spectacularly if you happen to indent incorrectly (but not intuitively). Thankfully, Jamis Buck points out a simple solution on the Ruby mailing list:


<% case number
when 1 %>
one
<% when 2 %>
two
<% else %>
something else
<% end %>

Thank you Jamis!

Posted in Uncategorized | No Comments » | Add to Delicious | Digg It

This entry was posted on Friday, March 14th, 2008 at 4:29 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply