ruby - Rails - Image_tag alternative image -


whats best way create image_tag(via rails helper) displays image if default 1 broken instead of text. doesn't have support recursion. have default image want use if link broken.

you can via js, here shown jquery:

$('img').error(function() {   $(this).attr('src', 'missing.png'); }); 

if it's specific image attach error handler object.

i don't know of way via image_tag helper; you'd have make request app src url , check error. i'd make sure that's need before going down road, though, depends on requirements.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -