Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/postgres_upsert/active_record.rb

Class Method Summary collapse

Class Method Details

.pg_upsert(path_or_io, options = {}) ⇒ Object

Copy data from a CSV that can be passed as a string (the file path) or as an IO object.

  • You can change the default delimiter passing delimiter: ” in the options hash

  • You can map fields from the file to different fields in the table using a map in the options hash

  • For further details on usage take a look at the README.md



9
10
11
# File 'lib/postgres_upsert/active_record.rb', line 9

def self.pg_upsert path_or_io, options = {}
  PostgresUpsert::Writer.new(self, path_or_io, options).write
end