class PostgresUpsert::WriteAdapters::ActiveRecordAdapter

Public Class Methods

new(destination, options) click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 4
def initialize(destination, options)
  @destination = destination
  @options = sanitize_options(options)
  
end

Public Instance Methods

column_names() click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 27
def column_names
  @destination.column_names
end
database_connection() click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 19
def database_connection
  @destination.connection
end
primary_key() click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 23
def primary_key
  @destination.primary_key
end
quoted_table_name() click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 31
def quoted_table_name
  @destination.quoted_table_name
end
sanitize_options(options) click to toggle source
# File lib/postgres_upsert/write_adapters/active_record_adapter.rb, line 10
def sanitize_options(options)
  options.slice(
    :delimiter, :unique_key
  ).reverse_merge(
    delimiter: ',',
    unique_key: [primary_key],
  )
end