I want to write a switch case in my view :
<% @prods.each_with_index do |prod, index|%>
<% case index %>
<% when 0 %><%= image_tag("#{prod.img}", :id => "one") %>
<% when 1 %><%= image_tag("#{prod.img}", :id => "two") %>
<% when 2 %><%= image_tag("#{prod.img}", :id => "three") %>
<% end %>
<% end %>
But it doesn’t work. Do I have to add a <% end %> somewhere in each line ? Any ideas ?
Thanks !
You should pull your first
wheninto same block ascase