Sha256: 614b75fb573319bd0b5440709f736984147990ec6dfa176fe3bd0a7399d79b2f

Contents?: true

Size: 303 Bytes

Versions: 4

Compression:

Stored size: 303 Bytes

Contents

class ActionController::Responder
  def to_csv
    name = "#{controller.current_client.id}_#{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

4 entries across 4 versions & 1 rubygems

Version Path
postgres-copy-0.3.4 lib/postgres-copy/csv_responder.rb
postgres-copy-0.3.3 lib/postgres-copy/csv_responder.rb
postgres-copy-0.3.2 lib/postgres-copy/csv_responder.rb
postgres-copy-0.3.1 lib/postgres-copy/csv_responder.rb