Sha256: 5134d8c191eb22964989be29abc43be5af956cabddebe5458e76dc5203d05ea7

Contents?: true

Size: 315 Bytes

Versions: 1

Compression:

Stored size: 315 Bytes

Contents

class ActionController::Responder
  def to_csv
    name = "#{controller.resource.class.name.downcase}_#{Time.now.to_i}"
    
    return controller.send_data controller.send(:end_of_association_chain).pg_copy_to_string, :filename => "/tmp/#{name}.csv", :type => "application/zip", :disposition => 'inline'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-postgres-copy-0.3.6 lib/postgres-copy/csv_responder.rb