Class: ActionController::Responder

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

Overview

For respond_to default

Instance Method Summary collapse

Instance Method Details

#to_csvObject



49
50
51
52
53
54
55
# File 'lib/cloudxls-rails/handlers/csv.rb', line 49

def to_csv
  if options[:stream] == true
    CloudXLSRails::CSVResponder.stream!(controller, resources.last, options)
  else
    controller.render({:csv => resources.last, :stream => false }.merge(options))
  end
end

#to_xlsObject



30
31
32
33
34
35
36
37
# File 'lib/cloudxls-rails/handlers/xls.rb', line 30

def to_xls
  stream = options.delete(:stream) || false
  if stream # either string or boolean
    options[:data] ||= {}
    options[:data][:url] ||= cloudxls_stream_url(stream, 'xls')
  end
  CloudXLSRails::XLSResponder.redirect!(controller, resources.last, options)
end

#to_xlsxObject



31
32
33
34
35
36
37
38
# File 'lib/cloudxls-rails/handlers/xlsx.rb', line 31

def to_xlsx
  stream = options.delete(:stream) || false
  if stream # either string or boolean
    options[:data] ||= {}
    options[:data][:url] ||= cloudxls_stream_url(stream, 'xlsx')
  end
  CloudXLSRails::XLSXResponder.redirect!(controller, resources.last, options)
end