Class: Keinaufwand::Sync::SyncState
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Keinaufwand::Sync::SyncState
- Defined in:
- lib/keinaufwand/sync_core/sync_state.rb
Class Method Summary collapse
- .cursor_for(resource_class) ⇒ Object
- .inherited(subclass) ⇒ Object
- .update_cursor!(resource_class, timestamp) ⇒ Object
Class Method Details
.cursor_for(resource_class) ⇒ Object
14 15 16 |
# File 'lib/keinaufwand/sync_core/sync_state.rb', line 14 def self.cursor_for(resource_class) find_by(resource_class: resource_class)&.last_synced_at end |
.inherited(subclass) ⇒ Object
8 9 10 11 12 |
# File 'lib/keinaufwand/sync_core/sync_state.rb', line 8 def self.inherited(subclass) super subclass.table_name = table_name subclass.primary_key = primary_key end |
.update_cursor!(resource_class, timestamp) ⇒ Object
18 19 20 21 22 |
# File 'lib/keinaufwand/sync_core/sync_state.rb', line 18 def self.update_cursor!(resource_class, ) state = find_or_initialize_by(resource_class: resource_class) state.last_synced_at = state.save! end |