edrich rocha edrich rocha - 3 months ago 33
CSS Question

how to add a src image path inside an image tag of another image rails

i want to add an image inside an image tag in rails how to do it?
if i try doing the following code it says the blank.gif is not present .
how to make it take the asset image part ... my blank.gif is present in asset/images

%img.sp-image{"data-src" => "#{gallery_image.image.url}", :src => "path/to/blank.gif"}/

i want to pass blank.gif in src by using something like asset_url so that it directly locates that file rather than giving the entire file path


you can use asset_path in your HAML

%img.sp-image{:alt => "image description", :src => asset_path("blank.gif")}