Hi this is not a question, but a solution for a problem :)
I updated rails from 5.1.x
to 5.2.x
, at this new rails version by default updates sprockets from 3.x.x
to 4.x.x
version. Therefor if you are using wicked_pdf
gem older version you might encounter problem like this:
ActionView::Template::Error:
undefined method `pathname' for #<Sprockets::Asset:0x0000564070ad65e0>
I was using wicked_pdf
version 1.1.x
. And i didnt found any similar issues. So after some time going trough the code i found out that older wickedpdf gem tries to get pathname
from the asset
and sprockets => 4.0.0
doesn't support pathname
and uses filename
old gem code:
asset ? asset.pathname : File.join(Rails.public_path, source)
new gem code:
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
So in conclusion if you updated your sprockets to v4 you must update your old wicked_pdf
gem also.