Class: Antz::Sink::ActiveRecord
- Inherits:
-
Object
- Object
- Antz::Sink::ActiveRecord
- Defined in:
- lib/antz/sink/active_record.rb
Instance Method Summary collapse
-
#initialize(model:, on_duplicate: :update) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #write(records) ⇒ Object
Constructor Details
#initialize(model:, on_duplicate: :update) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
6 7 8 9 |
# File 'lib/antz/sink/active_record.rb', line 6 def initialize(model:, on_duplicate: :update) @model = model @on_duplicate = on_duplicate end |
Instance Method Details
#write(records) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/antz/sink/active_record.rb', line 11 def write(records) return if records.empty? trigger_schema_load now = Time.current enriched_records = (records, now) persist_records(enriched_records) end |