ruby on rails 3.2 - Case statement in Slim -


is there way write case statement in slim following example. made changes stackoverflow question: how write switch statement in ruby

case when 1..5   = "it's between 1 , 5" when 6   = "it's 6" when string   = "you passed string" else   = "you gave me #{a} -- have no idea that." end 

i tried following generates error.

= case @taxon.name   = when "wedding cakes"     div.taxon-descripiton wedding cake description 

this told

... syntax error, unexpected tivar, expecting keyword_when ; @output_buffer.safe_concat(("<when>\"weddin... 

= used when want render something, when want call ruby logic without rendering in view should use -:

   - case @taxon.name          - when "wedding cakes"            div.taxon-descripiton wedding cake description 

i not sure solve problem though, have considered moving logic decorator anyway?


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -