Skip to content

Instantly share code, notes, and snippets.

@carloscortegagna
Created July 17, 2015 12:59
Show Gist options
  • Save carloscortegagna/0b6b0fc7500dcc9ff678 to your computer and use it in GitHub Desktop.
Save carloscortegagna/0b6b0fc7500dcc9ff678 to your computer and use it in GitHub Desktop.
module ApplicationHelper
include ActionView::Helpers::AssetTagHelper
def image_tag(source, options = {})
if options[:retina]
options['data-at2x'] = path_to_image(source.split('.').join('@2x.'))
options.tap { |h| h.delete(:retina) }
else
options['data-no-retina'] = ''
end
super(source, options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment