Sha256: a270e850166b9167d89b72e1c08a79fd1ec60b6d29606faa5744ee11d5519e6c
Contents?: true
Size: 667 Bytes
Versions: 1
Compression:
Stored size: 667 Bytes
Contents
require 'action_controller' Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx ActionController::Renderers.add :xlsx do |filename, options| options[:template] = filename disposition = options.delete(:disposition) || 'attachment' download_name = options.delete(:filename) || "#{filename}.xlsx" download_name += ".xlsx" unless download_name =~ /\.xlsx$/ send_data render_to_string(options), :filename => download_name, :type => Mime::XLSX, :disposition => disposition end # For respond_to default class ActionController::Responder def to_xlsx controller.render :xlsx => controller.action_name end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axlsx_rails-0.1.1 | lib/axlsx_rails/action_controller.rb |