module ActiveWorker::Behavior::HasRootObject
Public Class Methods
included(base)
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 11 def self.included(base) base.extend(ClassExtensions) base.before_save :set_root_object base.index({:root_object_id => -1}, {:background => true}) end
Public Instance Methods
get_root_object_id()
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 35 def get_root_object_id return root_object_id if root_object_id set_root_object root_object_id end
notify_root_of_child_started()
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 21 def notify_root_of_child_started if root_object root_object.child_started root_object.save! end end
notify_root_of_finished()
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 28 def notify_root_of_finished if root_object root_object.child_finished root_object.save! end end
root_owner()
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 17 def root_owner nil end
set_root_object()
click to toggle source
# File lib/active_worker/behavior/has_root_object.rb, line 41 def set_root_object return unless root_owner self.root_object_id = root_owner.get_root_object_id self.root_object_type = root_owner.root_object_type true end