Class: PostgresUpsert::WriteAdapters::ActiveRecordAdapter
- Inherits:
-
Object
- Object
- PostgresUpsert::WriteAdapters::ActiveRecordAdapter
- Defined in:
- lib/postgres_upsert/write_adapters/active_record_adapter.rb
Instance Method Summary collapse
- #column_names ⇒ Object
- #database_connection ⇒ Object
-
#initialize(destination, options) ⇒ ActiveRecordAdapter
constructor
A new instance of ActiveRecordAdapter.
- #primary_key ⇒ Object
- #quoted_table_name ⇒ Object
- #sanitize_options(options) ⇒ Object
Constructor Details
#initialize(destination, options) ⇒ ActiveRecordAdapter
Returns a new instance of ActiveRecordAdapter.
4 5 6 7 8 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 4 def initialize(destination, ) @destination = destination = () end |
Instance Method Details
#column_names ⇒ Object
27 28 29 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 27 def column_names @destination.column_names end |
#database_connection ⇒ Object
19 20 21 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 19 def database_connection @destination.connection end |
#primary_key ⇒ Object
23 24 25 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 23 def primary_key @destination.primary_key end |
#quoted_table_name ⇒ Object
31 32 33 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 31 def quoted_table_name @destination.quoted_table_name end |
#sanitize_options(options) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/postgres_upsert/write_adapters/active_record_adapter.rb', line 10 def () .slice( :delimiter, :unique_key ).reverse_merge( delimiter: ',', unique_key: [primary_key], ) end |