Sha256: 077ff8d1727a5144c7e35910a503e561f47c30a6229c5a4ae9032fd1af51063d

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

module NeatSpreadsheet::Implants
  class Railtie < Rails::Railtie
    initializer "neat-spreadsheet" do |app|
      ActiveSupport.on_load :action_view do
        require 'neat-spreadsheet/helpers'
      end

      ActionView::Template.register_template_handler :rxls, lambda { |template|
        NeatSpreadsheet.render_xls_string(template.source)
      }

      ActionController::Renderers.add :xls do |filename, options|
        send_data(render_to_string(options), filename: "#{filename}.xls", type: "application/vnd.ms-excel", disposition: "attachment")
      end

      Mime::Type.register "application/vnd.ms-excel", :xls if not Mime::Type.lookup_by_extension :xls
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neat-spreadsheet-0.0.1 lib/neat-spreadsheet/implants/railtie.rb