Sha256: 58ba65021d0e3865fe66690df75cf4a2dce42cee408565a4d0fa39b03a0995d9

Contents?: true

Size: 456 Bytes

Versions: 2

Compression:

Stored size: 456 Bytes

Contents

# frozen_string_literal: true

require "action_controller"

ActionController::Renderers.add :xls do |filename, options|
  # force layout false
  options[:layout] = false

  # disposition / filename
  disposition = options.delete(:disposition) || "attachment"
  file_name = options.delete(:filename) || "#{filename.gsub(/^.*\//, "")}.xls"

  send_data render_to_string(options), type: Columnify::Mime::XLS, filename: file_name, disposition: disposition
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
columnify-0.1.1 lib/columnify/action_controller.rb
columnify-0.1.0 lib/columnify/action_controller.rb