From: Phlip Date: 2008-08-17T12:31:58+09:00 Subject: Re: writing if statement in one line with elsif condition Luiz Vitor Martinez Cardoso wrote: > <% if @recipes.length == (i+1) then @id = 0 ; elsif > i.remainder(2) == 1 then @id = 1 ; else @id = 2 end >% How about this? <% if @recipes.length == (i+1) @id = 0 elsif i.remainder(2) == 1 @id = 1 else @id = 2 end %> I can't see what your specific error is, but that structure will at least be easier to read and debug. Also, any logic you can move to a controller - out of the <% erb %> - move it there. Or better, into a model. The view should have the minimum possible logic. -- Phlip