Sha256: aa721c567cfe6be03b296b12f9093537747184f673d8ccb3845ce5e20a98ea16

Contents?: true

Size: 991 Bytes

Versions: 2

Compression:

Stored size: 991 Bytes

Contents

#---
# Excerpted from "Crafting Rails Applications",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/jvrails for more book information.
#---
class HomeController < ApplicationController
  def index
    respond_to do |format|
      format.html
      format.xlsx
    end
  end

  def another
    render :xlsx => "index", :filename => "filename_test.xlsx"
  end

  def render_elsewhere
    render :xlsx => "/users/index"
  end

  def withpartial
  end

  def useheader
    respond_to do |format|
      format.xlsx {
        render xlsx: "useheader", disposition: "attachment", filename: "filename_test.xlsx"
        # response.headers['Content-Disposition'] = "attachment; filename=\"filename_test.xlsx\""
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axlsx_rails-0.1.4 spec/dummy/app/controllers/home_controller.rb
axlsx_rails-0.1.3 spec/dummy/app/controllers/home_controller.rb