Module: SyncBumper::Model::ClassMethods
- Defined in:
- lib/sync_bumper/model.rb
Instance Attribute Summary collapse
-
#sync_scope ⇒ Object
Returns the value of attribute sync_scope.
Instance Method Summary collapse
Instance Attribute Details
#sync_scope ⇒ Object
Returns the value of attribute sync_scope.
30 31 32 |
# File 'lib/sync_bumper/model.rb', line 30 def sync_scope @sync_scope end |
Instance Method Details
#sync(*actions) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sync_bumper/model.rb', line 32 def sync(*actions) include ModelActions if actions.last.is_a? Hash @sync_scope = actions.last.fetch :scope end actions = [:create, :update, :destroy] if actions.include? :all actions.flatten! if actions.include? :create after_create :publish_sync_create, :on => :create#, :if => lamda { Sync::Model.enabled? } end if actions.include? :update after_update :publish_sync_update, :on => :update#, :if => lamda { Sync::Model.enabled? } end if actions.include? :destroy after_destroy :publish_sync_destroy, :on => :destroy#, :if => lamda { Sync::Model.enabled? } end end |