Class: CloudXLSRails::XLSResponder

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudxls-rails/handlers/xls.rb

Class Method Summary collapse

Class Method Details

.redirect!(controller, scope, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cloudxls-rails/handlers/xls.rb', line 8

def self.redirect!(controller, scope, options)
  xdata = options[:data] || {}
  unless (xdata.has_key?(:text) ||
          xdata.has_key?(:url ) ||
          xdata.has_key?(:file)  )

    xdata[:text] = CloudXLS::CSVWriter.text(scope, options)
  end

  xopts = {:data => xdata}
  xopts[:sheet] = options[:sheet] if options[:sheet]
  xopts[:doc]   = options[:doc]   if options[:doc]

  response = CloudXLS.xpipe(xopts)
  controller.redirect_to response.url
end