Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/ud_sync/rails/model_extension.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.ud_sync(entity: nil, id: :id, owner: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ud_sync/rails/model_extension.rb', line 4 def ud_sync(entity: nil, id: :id, owner: nil) ||= {} class_name = self.name [class_name] = { entity: entity, id: id, owner: owner } self.after_save :save_operation self.after_destroy :save_operation end |
Instance Method Details
#save_operation ⇒ Object
19 20 21 |
# File 'lib/ud_sync/rails/model_extension.rb', line 19 def save_operation UdSync::Sentinel.new(self, [self.class.name]).save_operation end |