Blaming the asset pipeline in this case seems wrong. Its an optional thing that is there to speed up your application. If you're happy with a slower application that will fallback, this is easily configurable in config/environments/production.rb
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
I wouldn't recommend doing this though!
Although one could argue that this isn't a case where an exception error should be raised... the fact is you're pulling an image that doesn't exist.
So there is an error that your code needs to handle. IMO its better in Object Oriented code to fail massively instead of cleverly. This fail creates a nice failure message you can use to fix the code.
I would propose routing through a helper that could handle the error. Something like this which is a variant of this answer
def safe_image_tag(source, options = {})
begin
count = 0
source ||= "blank-profile-md.png"
image_tag(source, options)
rescue Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError
count += 1
source = "blank-profile-md.png"
retry if count < 2
end
end
This will in this one case recover and render your default image.