Skip to content

Instantly share code, notes, and snippets.

@ccyrille
Created May 5, 2012 08:22
Show Gist options
  • Select an option

  • Save ccyrille/2600892 to your computer and use it in GitHub Desktop.

Select an option

Save ccyrille/2600892 to your computer and use it in GitHub Desktop.
Helper to ignore asset pipeline exceptions when rendering images (for example, 'Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError')
module MyHelper
def image_tag_without_exception image_name, opts = {}
begin
return image_tag(image_name, opts)
rescue
# DO NOTHING
end
return ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment