diff --git a/lib/wicked_pdf/wicked_pdf_helper/assets.rb b/lib/wicked_pdf/wicked_pdf_helper/assets.rb index c7e4db8c..3d551798 100644 --- a/lib/wicked_pdf/wicked_pdf_helper/assets.rb +++ b/lib/wicked_pdf/wicked_pdf_helper/assets.rb @@ -68,7 +68,12 @@ def asset_pathname(source) end else asset = find_asset(source) - asset ? asset.pathname : File.join(Rails.public_path, source) + if asset + # older versions need pathname, Sprockets 4 supports only filename + asset.respond_to?(:filename) ? asset.filename : asset.pathname + else + File.join(Rails.public_path, source) + end end end