Zia Isam Zia Isam - 6 months ago 23
CSS Question

How to concat haml variable with img src string

I have haml loop with CSS class

thumbnail
, inside for loop I just wanna concat src string with for loop index.

%li.slide
%img.thumbnail{src=> 'string'i}

Answer

Your haml syntax is wrong, check this simple loop with img src string injection.

- (1..3).each do |i|
  %li.sld
    %img.thumbnail{:src => "string#{i}"}

you have missed : and wrong variable syntax i it should be #{i}.

try this way and comment me.