Class: Workarea::Orderbot::ImportLog
- Inherits:
-
Object
- Object
- Workarea::Orderbot::ImportLog
- Includes:
- ApplicationDocument
- Defined in:
- app/models/workarea/orderbot/import_log.rb
Class Method Summary collapse
Class Method Details
.log(type) {|last_imported_at| ... } ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/models/workarea/orderbot/import_log.rb', line 10 def self.log(type) instance = find_or_create_by(importer: type) last_imported_at = instance.started_at || 1.day.ago instance.update!(started_at: Time.current, finished_at: nil) yield(last_imported_at) instance.update!(finished_at: Time.current) end |