Zia Isam Zia Isam - 2 years ago 177
CSS Question

How to concat haml variable with img src string

I have haml loop with CSS class

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

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

Answer Source

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

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

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

try this way and comment me.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download