Sha256: 5d77d94edae564497af5ba4075e13d04362499697ed470b6641460a5aca35d05

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 Bytes

Contents

require 'wicked_pdf/pdf_helper'
require 'wicked_pdf/renderer'
require 'wicked_pdf/asset_helper'

module WickedPdf
  class Railtie < Rails::Railtie
    initializer 'wicked_pdf.register' do |_app|
      ActiveSupport.on_load(:action_controller) {
        ActionController::Base.send :prepend, PdfHelper
        ActionController::Renderers.add :pdf do |template, options|
          WickedPdf::Renderer.new(self).render(options.merge(pdf: template))
        end
      }
      ActiveSupport.on_load(:action_view) { include WickedPdf::AssetHelper }
    end
  end
end

if Mime::Type.lookup_by_extension(:pdf).nil?
  Mime::Type.register('application/pdf', :pdf)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adzap-wicked_pdf-2.0.0.beta5 lib/wicked_pdf/railtie.rb
adzap-wicked_pdf-2.0.0.beta4 lib/wicked_pdf/railtie.rb