scinote-web/config/initializers/wicked_pdf.rb

22 lines
608 B
Ruby
Raw Normal View History

2016-07-21 19:11:15 +08:00
WickedPdf.config ||= {}
2016-02-12 23:52:43 +08:00
# WickedPdfHelper patch that fixes issue with including application.css
2016-07-21 19:11:15 +08:00
# in environments like Heroku where assets.compile option is disabled and
2016-02-12 23:52:43 +08:00
# it is not acceptable to enable it.
if Rails.env.production? and Rails.configuration.assets.compile == false
WickedPdfHelper::Assets.module_eval do
def read_asset(source)
manifest = Rails.application.assets_manifest
path = File.join(manifest.dir, manifest.assets[source])
File.read(path)
end
def asset_exists?(source)
Rails.application.assets_manifest.assets.key?(source)
end
end
end